cURL and COOKIES -How to set?
Posted: Fri Nov 21, 2003 10:33 pm
I'm trying to set cookies when posting to a page.
I got the script practically copied from PHP Cookbook with minor alterations:
$post_arr = array (username =>'alexeiz' ,password =>'GOVNO32');
$c = curl_init('http://www.alexeiz.com/hit.php');
curl_setopt($c,CURLOPT_VERBOSE,1);
curl_setopt($c,CURLOPT_COOKIE,'user=MUDAK');
curl_setopt($c, CURLOPT_POSTFIELDS, $post_arr);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$page = curl_exec($c);
curl_close($c);
echo "<br> $page";
Postfields are posted OK, but the cookie is never set - tried many times in different enviroments.
What could be the problem? PHP is 4.3.2, cURL 7.10.3
I got the script practically copied from PHP Cookbook with minor alterations:
$post_arr = array (username =>'alexeiz' ,password =>'GOVNO32');
$c = curl_init('http://www.alexeiz.com/hit.php');
curl_setopt($c,CURLOPT_VERBOSE,1);
curl_setopt($c,CURLOPT_COOKIE,'user=MUDAK');
curl_setopt($c, CURLOPT_POSTFIELDS, $post_arr);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$page = curl_exec($c);
curl_close($c);
echo "<br> $page";
Postfields are posted OK, but the cookie is never set - tried many times in different enviroments.
What could be the problem? PHP is 4.3.2, cURL 7.10.3