note 108051 added to function.curl-init
| From: | morfin60 at gmail dot com | Date: | Sat, 24 Mar 2012 22:24:05 +0000 |
| Subject: | note 108051 added to function.curl-init | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-186808@lists.php.net to get a copy of this message | ||
As i know if you use application/x-www-form-urlencoded then you can post checkboxes array(with names
like "mycheckbox[]") with query string like that:
<?php
$postFields="sometextfield=sometextvalue&somecheckbox[1]=1&somecheckbox[2]=3&somecheckbox[3]=7";
?>
but if you use multipart/form-data(and pass array as third parameter) you can do something like that
to do that:
<?php
...
$postFields = array(
"sometextfield" => "sometextvalue",
"somecheckbox[1]" => "1",
"somecheckbox[2]" => "4",
"somecheckbox[5]" => "6"
);
curl_setopt($curl,CURLOPT_POSTFIELDS,$postFields);
...
?>
that will send one dimension array but receiveing script will get multidimensional array like that:
Array (
[sometextfield] => sometextvalue
[somecheckbox] => Array ( [1] => 1
[2] => 4
[5] => 6
)
)
----
Server IP: 195.54.192.44
Probable Submitter: 94.31.178.66
----
Manual Page -- http://www.php.net/manual/en/function.curl-init.php
Edit -- https://master.php.net/note/edit/108051
Del: integrated -- https://master.php.net/note/delete/108051/integrated
Del: useless -- https://master.php.net/note/delete/108051/useless
Del: bad code -- https://master.php.net/note/delete/108051/bad+code
Del: spam -- https://master.php.net/note/delete/108051/spam
Del: non-english -- https://master.php.net/note/delete/108051/non-english
Del: in docs -- https://master.php.net/note/delete/108051/in+docs
Del: other reasons-- https://master.php.net/note/delete/108051
Reject -- https://master.php.net/note/reject/108051
Search -- https://master.php.net/manage/user-notes.php