#27202 [Com]: CURLOPT_POSTFIELDS and CURLOPT_POST don't work properly
ID: 27202
Comment by: fido at list dot pl
Reported By: leander2 at berwers dot com
Status: Bogus
Bug Type: cURL related
Operating System: Linux
PHP Version: Irrelevant
New Comment:
Sorry to bother You, but could You point me to a place in manual where
this option is described??
I searched it a few times (with and without Ctrl+F) and couldn't find
it. Maybe this "feature" is not yet documented?
I've lost a few hours today fighting with this.. and gave up. I did it
by reinitiating CURL.
Previous Comments:
------------------------------------------------------------------------
[2004-02-10 11:14:43] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
You need to set curl_setopt($ch, CURLOPT_HTTPGET, 1); for
the 2nd request, the
curl_setopt($ch, CURLOPT_URL,"http://second");
curl_setopt($ch, CURLOPT_POST, 0);
are not needed for request #2.
------------------------------------------------------------------------
[2004-02-10 04:46:46] leander2 at berwers dot com
Description:
------------
CURLOPT_POST = 0 and/or CURLOPT_POSTFIELDS = null does actually do a
POST while a GET is required
Reproduce code:
---------------
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://first");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $b);
$x = curl_exec($ch);
curl_setopt($ch, CURLOPT_URL,"http://second");
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, null);
curl_close($ch);
Expected result:
----------------
The first request should be a POST and the second request should be a
GET.
Actual result:
--------------
The first request is a POST (which is ok), but the second request is
also a POST.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27202&edit=1
Thread (3 messages)