You were probably locked out during the login process. This will give you more information about the problem:
// change // if (!$siteSource) echo 'Help!'; // to if ($siteSource === false) { echo 'Curl error: ' . curl_error($curl); }
EDIT: some others choose what you can try (SSL solution resolved my problems more than once):
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0)'); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_VERBOSE, 1); // following is very important // TRUE to follow any "Location: " header that the server sends // as part of the HTTP header (note this is recursive, PHP will follow // as many "Location: " headers that it is sent, unless CURLOPT_MAXREDIRS is set). curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
EDIT 2: Once selected, you will get returned headers (use only for debugging). Also, make sure that cookie.txt is used correctly (locally and writable).
curl_setopt($curl, CURLOPT_HEADER, true);
Thatโs all I can do on my part. And now lunch!
EDIT 3: Cookie Related Material:
$cookie_file = PATH_TO_YOUR_COOKIE_FILE . '/cookie.txt'; if (! file_exists($cookie_file) || ! is_writable($cookie_file)) { echo 'Cookie file missing or not writable.'; exit; } // you already added the following, I put it again just to remark their utility curl_setopt($curl, CURLOPT_COOKIEFILE, $cookie_file); curl_setopt($curl, CURLOPT_COOKIEJAR, $cookie_file);
EDIT 4: always check this at the beginning:
if ( ! extension_loaded('curl')) { echo "You need to load/activate the curl extension."; }
If you get this error, activate curl in php.ini uncomment / delete front panel ;
windows: ;extension=php_curl.dll
and restart the web server. If you did not find this line, you need to install curl:
// ubuntu sudo apt-get install php5-curl // centos sudo yum install php5-curl
For windows or your wampserver should be easy too.