note 41850 deleted from ref.curl by tomsommer
| From: | tomsommer@php.net | Date: | Sun, 22 Aug 2004 21:55:57 +0000 |
| Subject: | note 41850 deleted from ref.curl by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-75135@lists.php.net to get a copy of this message | ||
Note Submitter: setec at freemail dot it
----
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
?>