Provide a redirected-to URI
|Reported by:||cogmios||Owned by:|
|Component:||HTTP API||Keywords:||2nd-opinion needs-patch|
This discussion started (For me) here: http://wordpress.stackexchange.com/questions/11951/wp-remote-get-with-manual-redirect/11964#11964 (my name is edward de leau)
I then had contact with Scott Kingsley Clark who opened that thread and did not have time to work on it yet. I have the same problem:
I need to know where a url redirects to, to detect its base url (to extract favicons from).
So I made a redirect=0 and did manual processing: http://plugins.trac.wordpress.org/browser/wp-favicons/trunk/includes/class-http.php but discovered that from my testset of 1500 found favicons 500 were supplied by google because of the line 'Too many redirections'.
This was because the parameter FOLLOWLOCATION could not be set. See ticket : https://core.trac.wordpress.org/ticket/16855#comment:29
and my question: http://wordpress.stackexchange.com/questions/11951/wp-remote-get-with-manual-redirect/11964#11964 where Hakre supplied a fix to set FOLLOWLOCATION which works but the ticket is still under discussion.
So I had another approach: maybe just supply the URI that was redirected to. For CURL this can be done easily by adding a one-liner "do_action( 'http_api_curl_info', $handle);" directly after the exec call. For the other I have not researched this.
Would this be an option? (this IS the reason Curl supplies this information array with the forwarded URI). (then catchable via $info = curl_getinfo($handle);)