#47906 [Opn]: CURLOPT_POSTFIELDS accepts only strings
ID: 47906
User updated by: klas at k-k-k dot biz
Reported By: klas at k-k-k dot biz
Status: Open
-Bug Type: Documentation problem
+Bug Type: Scripting Engine problem
Operating System: windows
PHP Version: 5.2.9
New Comment:
Sorry, but that doesn't work.
Note that this is a different problem that the one described on that
page.
Previous Comments:
------------------------------------------------------------------------
[2009-04-06 12:46:24] jani@php.net
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/
------------------------------------------------------------------------
[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
Thread (7 messages)