note 102591 added to function.curl-copy-handle
| From: | lxyfirst at 163 dot com | Date: | Wed, 23 Feb 2011 08:29:11 +0000 |
| Subject: | note 102591 added to function.curl-copy-handle | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-177244@lists.php.net to get a copy of this message | ||
There is a crash when use cookie with curl_copy_handle as below:
$url = "http://www.google.com.hk" ;
$cookie_file = tempnam("/tmp","curl") ;
$curl_handle= curl_init() ;
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_COOKIEJAR, $cookie_file);
curl_setopt($curl_handle, CURLOPT_COOKIEFILE, $cookie_file);
curl_setopt($curl_handle, CURLOPT_URL, $url);
$return_data = curl_exec($curl_handle);
$curl_tmp = curl_copy_handle($curl_handle);
curl_close($curl_handle) ;
$cookie_data = file_get_contents($cookie_file) ;
var_dump($cookie_data) ; //first request success
$curl_handle = $curl_tmp ;
curl_setopt($curl_handle, CURLOPT_URL, $url);
$return_data = curl_exec($curl_handle); //second request crash here
----
Server IP: 222.73.207.145
Probable Submitter: 127.0.0.1 (proxied: 116.236.150.69)
----
Manual Page -- http://www.php.net/manual/en/function.curl-copy-handle.php
Edit -- https://master.php.net/note/edit/102591
Del: integrated -- https://master.php.net/note/delete/102591/integrated
Del: useless -- https://master.php.net/note/delete/102591/useless
Del: bad code -- https://master.php.net/note/delete/102591/bad+code
Del: spam -- https://master.php.net/note/delete/102591/spam
Del: non-english -- https://master.php.net/note/delete/102591/non-english
Del: in docs -- https://master.php.net/note/delete/102591/in+docs
Del: other reasons-- https://master.php.net/note/delete/102591
Reject -- https://master.php.net/note/reject/102591
Search -- https://master.php.net/manage/user-notes.php