Following Redirects in CURL in PHP
The following command forces CURL to follow HTTP redirects:
<?php
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
?>
Given two pages:
<?php
header('Location: page2.php');
die();
?>
<?php
echo 'success';
?>
Access the first page via CURL. Make sure it follows the redirect when the appropriate setting is enabled.