CURL, PHP & COOKIES - can ANYBODY help??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
alexeiz
Forum Newbie
Posts: 12
Joined: Mon Oct 20, 2003 9:31 pm
Location: Los Angeles

CURL, PHP & COOKIES - can ANYBODY help??

Post by alexeiz »

I REALLY need help - does anybody has any idea?

$post_arr = array (username =>'alexeiz' ,password =>'GOVNO');
$c = curl_init('http://www.sampledomain.com/login.php');
curl_setopt($c,CURLOPT_VERBOSE,1);
curl_setopt($c, CURLOPT_POSTFIELDS, $post_arr);
curl_setopt($c,CURLOPT_COOKIE,'username=alexeiz;password='GOVNO');
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$page = curl_exec($c);
curl_close($c);

echo "<p> $page";
--------------------------------------------------------
This script does login correctly. But it also supposed to set cookies on the client that triggers this script and it does NOT!
These cookies are needed so in the next CURL call the client can access other pages at http://www.sampledomain.com that require these cookies to authorize the client.

Is there anything wrong here, and if it is, how to achieve this goal?
Post Reply