note 41565 deleted from ref.curl by tomsommer
| From: | tomsommer@php.net | Date: | Sun, 22 Aug 2004 21:55:55 +0000 |
| Subject: | note 41565 deleted from ref.curl by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-75134@lists.php.net to get a copy of this message | ||
Note Submitter: a_zazello at yahoo dot com
----
If I want to use CURLOPT_COOKIEFILE and CURLOPT_POSTFIELDS in the same request.
The post fields are not inserted in the HTTP header as I expected!
$url = "http://www.url.com";
$data = "key1=val1&key2=val2";
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_COOKIEFILE, "cook");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$result = curl_exec($ch); // run the whole process
curl_close($ch);
echo $result;
PHP 4.3.3 libcurl/7.10.5