#27202 [Opn->Bgs]: CURLOPT_POSTFIELDS and CURLOPT_POST don't work properly
ID: 27202
Updated by: iliaa@php.net
Reported By: leander2 at berwers dot com
-Status: Open
+Status: Bogus
Bug Type: cURL related
Operating System: Linux
PHP Version: Irrelevant
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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)