Feb 232015
 

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!

 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)