note 107621 added to function.curl-setopt
| From: | dotpointer at gmail dot com | Date: | Wed, 22 Feb 2012 13:13:15 +0000 |
| Subject: | note 107621 added to function.curl-setopt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-186273@lists.php.net to get a copy of this message | ||
I noted something when using CURLOPT_POSTFIELDS in combination with arrays from PHP.
You may supply an array, but there may not be any sub-arrays in this array, as this will give
Array-to-string-conversion notice.
Example:
$ch = curl_init();
# this works
$data = array('name' => 'value');
# this gives "Notice: Array to string conversion..."
$data = array('name' => array('subname' => 'subvalue'));
curl_setopt($ch, CURLOPT_URL, 'http://localhost/test.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_exec($ch);
----
Server IP: 69.147.83.197
Probable Submitter: 213.136.59.78
----
Manual Page -- http://www.php.net/manual/en/function.curl-setopt.php
Edit -- https://master.php.net/note/edit/107621
Del: integrated -- https://master.php.net/note/delete/107621/integrated
Del: useless -- https://master.php.net/note/delete/107621/useless
Del: bad code -- https://master.php.net/note/delete/107621/bad+code
Del: spam -- https://master.php.net/note/delete/107621/spam
Del: non-english -- https://master.php.net/note/delete/107621/non-english
Del: in docs -- https://master.php.net/note/delete/107621/in+docs
Del: other reasons-- https://master.php.net/note/delete/107621
Reject -- https://master.php.net/note/reject/107621
Search -- https://master.php.net/manage/user-notes.php