note 41850 added to ref.curl
| From: | setec at freemail dot it | Date: | Fri, 23 Apr 2004 16:23:34 +0000 |
| Subject: | note 41850 added to ref.curl | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-68677@lists.php.net to get a copy of this message | ||
Hi, I spent half a day to get it out, it isn't well documented.
If you want to use the same cURL session to make a POST request and then a GET request you need to
use the CURLOPT_HTTPGET option, otherwise cURL will continue to execute a POST request. Sample code
follows.
<?php
// curl initialization
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
// execute a POST request
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, null);
curl_setopt($ch, CURLOPT_HTTPGET, 1);
// execute a GET request on the same cURL session
?>
----
Manual Page -- http://www.php.net/manual/en/ref.curl.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41850
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41850&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41850&report=yes
Search -- http://master.php.net/manage/user-notes.php