i've been following tutorials by the letter, but can't get my curl login script to work
do you see something that i might be doing incorrect?
do you see something that i might be doing incorrect?
Code:
$loginPage = '[URL unfurl="true"]http://www.test_page_login.com';[/URL]
$useragent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1";
$referrer = '[URL unfurl="true"]http://www.test.com';[/URL]
$cookieFile = 'cookie.txt';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, ''.$loginPage.'');
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_REFERER, ''.$referrer.'');
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, 'emailx=test@email.com&password=myPass');
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookieFile);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookieFile);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec ($ch);
$content = curl_exec ($ch);
curl_close ($ch);
echo '<p>'.$content.'</p>';