note 61395 added to ref.curl
| From: | luca dot manzo at bbsitalia dot com | Date: | Thu, 02 Feb 2006 11:55:27 +0000 |
| Subject: | note 61395 added to ref.curl | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-102863@lists.php.net to get a copy of this message | ||
If you're getting trouble with cookie handling in curl:
- curl manages tranparently cookies in a single curl session
- the option
curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookieFileName");
makes curl to store the cookies in a file at the and of the curl session
- the option
curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/cookieFileName");
makes curl to use the given file as source for the cookies to send to the server.
so to handle correctly cookies between different curl session, the you have to do something like
this:
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_COOKIEJAR, COOKIE_FILE_PATH);
curl_setopt ($ch, CURLOPT_COOKIEFILE, COOKIE_FILE_PATH);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec ($ch);
curl_close($ch);
return $result;
in particular this is NECESSARY if you are using PEAR_SOAP libraries to build a webservice client
over https and the remote server need to establish a session cookie. in fact each soap message is
sent using a different curl session!!
I hope this can help someone
Luca
----
Server IP: 213.92.11.19
Probable Submitter: 213.215.240.2
----
Manual Page -- http://www.php.net/manual/en/ref.curl.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+61395
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61395&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61395&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61395&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61395&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61395&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61395&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61395&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+61395&report=yes
Search -- http://master.php.net/manage/user-notes.php