Hey,
I'm trying to log in using cURL and I need to set the session, but the cookie.txt is always emty and session is nerver set. hope someone can help...
here is my code:
<?php
// INIT CURL
$ch = curl_init();
// SET URL FOR THE POST FORM LOGIN
curl_setopt($ch, CURLOPT_URL, 'http://localhost/parts/padmin/login.php');
// ENABLE HTTP POST
curl_setopt ($ch, CURLOPT_POST, 1);
// SET POST PARAMETERS : FORM VALUES FOR EACH FIELD
curl_setopt ($ch, CURLOPT_POSTFIELDS, 'user=gio&pass=gio');
// IMITATE CLASSIC BROWSER'S BEHAVIOUR : HANDLE COOKIES
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
// EXECUTE 1st REQUEST (FORM LOGIN)
$store = curl_exec ($ch);
// CLOSE CURL
curl_close ($ch);
?>