#47906 [Opn->Fbk]: CURLOPT_POSTFIELDS accepts only strings
| From: | iliaa@php.net | Date: | Mon, 06 Apr 2009 14:15:25 +0000 |
| Subject: | #47906 [Opn->Fbk]: CURLOPT_POSTFIELDS accepts only strings | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-135589@lists.php.net to get a copy of this message | ||
ID: 47906
Updated by: iliaa@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.9
New Comment:
Works fine for me with both 5.2 and 5.3. What version of libcurl are
you
using?
Previous Comments:
------------------------------------------------------------------------
[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