Page 1 of 1

Getting all redirect URLs

Posted: Fri Jan 30, 2009 5:59 pm
by GeXus
Does anyone know how you would capture all the URL's that a url redirects to?

For example, let's say the url http://www.example.com/test

Redirects to:

http://www.example.com/test/1
http://www.example.com/test/1/?something=1
http://www.example.com/test/1/?another=1

I would want to print out all of the URL's above that were redirected to. I know in Curl you can follow redirects, but not sure you capture each one.

I

Re: Getting all redirect URLs

Posted: Fri Jan 30, 2009 6:20 pm
by requinix
You can, with curl_getinfo and CURLINFO_REDIRECT_URL. Stick some code into a loop and you're set.

Re: Getting all redirect URLs

Posted: Fri Jan 30, 2009 6:26 pm
by jh_1981