cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-and-php mailing list Archives

cookies problem

From: cata keat <cata_keat_at_yahoo.com>
Date: Tue, 7 Jul 2009 06:29:35 -0700 (PDT)

Hi ! I am new here and also to curl .
One question :
why the curl does not save the cookis in the file :
<?php
/*
This script is an example of using curl in php to log into on one page and
then get another page passing all cookies from the first page along with you.
If this script was a bit more advanced it might trick the server into
thinking its netscape and even pass a fake referer, yo look like it surfed
from a local page.
*/
$cookie="cookie.txt";
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR,$cookie);
curl_setopt($ch, CURLOPT_URL,"https://accounts.craigslist.org/login");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,inputEmailHandle=arsulescucata_at_yahoo.com&inputPassword=pwdxxx);
ob_start();      // prevent any output
curl_exec ($ch); // execute the curl command

ob_end_clean();  // stop preventing output
curl_close ($ch);
unset($ch);
 $cookie_contents = file_get_contents($cookie);
echo $cookie_contents;
?>
Bests regards!

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2009-07-07

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET