note 113029 added to function.curl-setopt
| From: | mfuhrman at enetarch dot net | Date: | Tue, 20 Aug 2013 23:20:03 +0000 |
| Subject: | note 113029 added to function.curl-setopt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-196030@lists.php.net to get a copy of this message | ||
Here is an example of sending JSON data as via POST.
index.php
------
$data = array
(
"command" => "isInstalled",
"params" => Array
(
"1" => "3",
"2" => "4",
)
);
$data_string = "json=" . json_encode($data) . "&";
$ch = curl_init("http://localhose/parrot.php");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
$results = curl_exec($ch);
print ($results);
?>
=====
parrot.php
------
<?
print_r ($_REQUEST);
?>
----
Server IP: 69.147.83.199
Probable Submitter: 98.234.149.191
----
Manual Page -- http://php.net/manual/en/function.curl-setopt.php
Edit -- https://master.php.net/note/edit/113029
Del: integrated -- https://master.php.net/note/delete/113029/integrated
Del: useless -- https://master.php.net/note/delete/113029/useless
Del: bad code -- https://master.php.net/note/delete/113029/bad+code
Del: spam -- https://master.php.net/note/delete/113029/spam
Del: non-english -- https://master.php.net/note/delete/113029/non-english
Del: in docs -- https://master.php.net/note/delete/113029/in+docs
Del: other reasons-- https://master.php.net/note/delete/113029
Reject -- https://master.php.net/note/reject/113029
Search -- https://master.php.net/manage/user-notes.php