#47906 [Opn->Fbk]: CURLOPT_POSTFIELDS accepts only strings
ID: 47906
Updated by: pajoye@php.net
Reported By: klas at k-k-k dot biz
-Status: Open
+Status: Feedback
Bug Type: Scripting Engine problem
Operating System: windows
PHP Version: 5.2.8
New Comment:
Please try a 5.3 VC9 snapshot (using cli, IIS with NTS, or
apachelounge.com's apache for the ts version).
You can fetch at http://windows.php.net
Previous Comments:
------------------------------------------------------------------------
[2009-04-06 14:35:15] klas at k-k-k dot biz
I'm using xampp that currently comes with php 5.2.8. and libcurl 7.16.0
------------------------------------------------------------------------
[2009-04-06 14:15:24] iliaa@php.net
Works fine for me with both 5.2 and 5.3. What version of libcurl are
you
using?
------------------------------------------------------------------------
[2009-04-06 13:11:04] klas at k-k-k dot biz
Sorry, but that doesn't work.
Note that this is a different problem that the one described on that
page.
------------------------------------------------------------------------
[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)