#47906 [Opn]: CURLOPT_POSTFIELDS accepts only strings
| From: | jani@php.net | Date: | Mon, 06 Apr 2009 12:46:25 +0000 |
| Subject: | #47906 [Opn]: CURLOPT_POSTFIELDS accepts only strings | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-2084@lists.php.net to get a copy of this message | ||
ID: 47906
Updated by: jani@php.net
Reported By: klas at k-k-k dot biz
Status: Open
-Bug Type: Scripting Engine problem
+Bug Type: Documentation problem
Operating System: windows
PHP Version: 5.2.9
New Comment:
You just need to disable the Expect header cURL sends by default:
http://the-stickman.com/web-development/php-and-curl-disabling-100-continue-header/
Previous Comments:
------------------------------------------------------------------------
[2009-04-06 11:48:31] klas at k-k-k dot biz
Description:
------------
Inserting array (key=>value) as CURLOPT_POSTFIELDS doesn't work
although documentation states:
"This can either be passed as a urlencoded string like
'para1=val1¶2=val2&...' or as an array with the field name as key
and field data as value. "
Reproduce code:
---------------
$url="example.php";
$process = curl_init($url);
$data= array ('somefield'=>'somedata')
curl_setopt($process, CURLOPT_POSTFIELDS, $data);
curl_exec($process);
curl_close($process);
Expected result:
----------------
input field "somefield" with value "somedata" posted to example.php
Actual result:
--------------
Empty field/value
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47906&edit=1