What happens when PHP’s CURL library¬†encounters a 301 Redirect header? It depends.

By default, it does NOT redirect. It will simply halt after the header is returned.

However, there is an option you can set that allows it to follow up to 5 redirects in a chain: the CURLOPT_FOLLOWLOCATION setting.

curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);

Hope that helps anyone else out there that was curious!

About Shane
Shane is the creator of AdSense split testing wordpress plugin AmpedSense and web hosting tester HostBenchmarker. You can follow his entrepreneurial activities on his blog SideProjectProfit

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

   
© 2012 ShaneLabs Suffusion theme by Sayontan Sinha