I set
add_filter( 'http_request_redirection_count', array($instance,'SetDirectionCount'));
to 0
I try to get 'http://boards.ign.com/The_Vestibule/b5296/' or 'http://www.informationweek.com/story/' but that gives me:
WP_Error Object ( [errors] => Array ( [http_request_failed]
=> Array ( [0] => Maximum (0) redirects followed ) ) [error_data] => Array ( ) )
The head does not show me a redirection:
Array ( [headers] => Array ( [connection] => close [date] =>
Mon, 14 Mar 2011 01:40:19 GMT [server] => Microsoft-IIS/6.0 [p3p] => Array ( [0] =>
CP='NOI ADMa OUR STP' [1] => CP="TST" ) [x-powered-by] => ASP.NET [cluster-server] => \ ignprdappw64212 [x-aspnet-version] => 2.0.50727 [pragma] => no-cache [x-aspnetmvc-version]
=> 1.0 [set-cookie] => BoardCookieV3%5Fboards%2Eign%2Ecom=dc=no&ra=False; expires=Wed, 14-Mar-2012 01:40:19 GMT; path=/; HttpOnly [cache-control] => private [expires] => Wed, 14
Mar 2001 01:40:19 GMT [content-type] => text/html; charset=utf-8 ) [body] => [response] =>
Array ( [code] => 200 [message] => OK ) [cookies] => Array ( [0] => WP_Http_Cookie
Object ( [name] => BoardCookieV3%5Fboards%2Eign%2Ecom [value] => dc=no&ra=False
[expires] => 1331689219 [path] => / [domain] => [httponly] => ) ) )
Now... what I would have liked is information back from the head request that a 301 or 302 would be happening or even a 404, so that I could wp_remote_get that one instead.
Am I doing something wrong?
FYI: I need to manually redirect because I need to determine the base_href of an image if none is given in the HTML source (code: http://plugins.trac.wordpress.org/browser/wp-favicons/trunk/includes/class-http.php ) or some more background: http://wp.leau.co/2011/03/18/handling-redirects-for-wp-favicons-with-redirects-set-to-0-with-wordpress-wp_remote_get/