I have written a small code to send a request using curl. following is an example.
request.php
====================
$ret = "sent data";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://localhost/rest2/use.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $ret);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
$error = curl_error($ch);
curl_close($ch);
print_r($result); // print the returned array from use.php
Now the page which receives the curl response, it has only one line
use.php
====================
return array("fn"=>"first name", "ln"=>"last name");
but in my request.php I am unable to get the array and print it.
How I can pass an array of values from use.php to request.php?
Help is appreciated.
cheers