cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

RE: cookies problem

From: Liu Shan Shui <me_at_lx.sg>
Date: Tue, 7 Jul 2009 21:59:44 +0800

Hi Cata,

 

It could be because of, in the order of likeliness:

 

1. file permissions - CHMOD cookies.txt to 777.

2. cURL error, typically something about SSL certificates - I see that
you're connecting to a HTTPS URL. You may want to set CURLOPT_SSL_VERIFYPEER
and CURLOPT_SSL_VERIFYHOST to false.

3. PHP parse error on the line with CURLOPT_POSTFIELDS - quote that string
there.

4. you don't have cURL installed on your server (should get a fatal error on
this, but may not be shown depending on error_reporting() settings).

 

With regards,

Liu Shan Shui

me_at_lx.sg

"Life would be much easier if I had the source code." - Anonymous

 

From: curl-and-php-bounces_at_cool.haxx.se
[mailto:curl-and-php-bounces_at_cool.haxx.se] On Behalf Of cata keat
Sent: Tuesday, July 07, 2009 9:30 PM
To: curl-and-php_at_cool.haxx.se
Subject: cookies problem

 

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
<mailto:inputEmailHandle=arsulescucata_at_yahoo.com&inputPassword=pwdxxx>
&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