I am using cURL over PHP to access an ASPX website. On my browser it shows that upon request I get a 302 Found (which is redirecting actually to another site), and immediately another request to the redirect page.
On my cURL I always get the 200 OK, which is ironically wrong , as the next page I am accessing (immitating the redirect) returns a 500, prehaps something was done wrong in the previous page.
as a test I tried to access my own website on which I am redirecting the page. I also got a 200 OK on the curl_getinfo($curl); but the contents of the returned page showed specifically that the header was HTTP/1.1 302 Found
one more weird thing is that the curl_getinfo($curl); returns a 200 OK all the time, even when I access my own website when I actually know I am redirecting.
Any ideas why I get a 200 OK instead of a 302 on my curl_getinfo?
Thanks!
In addition to the CURLOPT_FOLLOWLOCATION answers:
You can also set the CURLOPT_HEADERFUNCTION option and take a look at the redirect(s), e.g. via
With CURLOPT_FOLLOWLOCATION enabled you should get an output like
which in this case shows that a request for http://spiegel.de is redirected to http://www.spiegel.de