Trying to login to site with PHP & cURL? Trying to login to site with PHP & cURL? curl curl

Trying to login to site with PHP & cURL?


try to echo each request to see if something went wrong.(enabling CURLOPT_RETURNTRANSFER)


I suggest you to use

curl_setopt($ch, CURLOPT_COOKIEFILE, '/dev/null');

This way cookies are stored internally in-memory without the need of a separated file.


It works for me with "persist=1" , not "persist=on" :

$options[CURLOPT_POSTFIELDS] = 'emailAddress=lala@yahoo.com&pswd=jblake&persist=on'; // doesn't work$options[CURLOPT_POSTFIELDS] = 'emailAddress=lala@yahoo.com&pswd=jblake&persist=1'; // works$options[CURLOPT_POSTFIELDS] = 'emailAddress=lala@yahoo.com&pswd=jblake'; // also works