|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27040 passing an array of form-fields to CURLOPT_POSTFIELDS does not work
Submitted: 2004-01-25 18:58 UTC Modified: 2004-01-25 19:13 UTC
From: Assigned:
Status: Closed Package: cURL related
PHP Version: 4CVS, 5CVS OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
32 - 28 = ?
Subscribe to this entry?

 [2004-01-25 18:58 UTC]
Using variable works, using plain array doesn't.

Reproduce code:
$ch = curl_init('');
curl_setopt($ch,CURLOPT_POSTFIELDS, array ('field1'=>'1','field2'=>'2'));
$result = curl_exec($ch);

Expected result:
string(463) "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en-US">
<title>Echoing submitted form data</title>
<h1 style="font-size:1.2em">Echoing submitted form data</h1>
<table border="1" cellspacing="0">
<tr><th align="left" nowrap><tt>field1</tt></th><td nowrap><tt>1</tt></td></tr>
<tr><th align="left" nowrap><tt>field2</tt></th><td nowrap><tt>2</tt></td></tr>
<p>Processed 2004-01-26T00:01Z

Actual result:
The field values appear as 'Z' 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-25 19:13 UTC]
Fixed in CVS.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Dec 04 14:01:28 2023 UTC