|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-09-23 18:48 UTC] pasindu@php.net
[2017-01-28 12:57 UTC] cmb@php.net
-Package: Documentation problem
+Package: cURL related
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 11:00:02 2025 UTC |
Description: ------------ If curl_setopt() is used to set CURLOPT_POSTFIELDS with an array, it will not work unless CURLOPT_POST has been set to true first. This works: $parameters = array("test" => "testing"); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters); This posts and empty form: $parameters = array("test" => "testing"); curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters); curl_setopt($ch, CURLOPT_POST, TRUE); However, this works: $parameters = "test=testing"; curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters); curl_setopt($ch, CURLOPT_POST, TRUE); It would be very helpful if a note was added in the documentation for CURLOPT_POSTFIELDS that CURLOPT_POST must be set to true before passing an array or it will not be automatically converted to a query string.