Reputation: 15010
I am trying to send post datas to my server.
$url = 'http://my_server';
$data = http_build_query(array(
"conditions" => [
["id", "1", "equal"],
["jd", array("a" => "b",
"c" => "d"), "equal"]
]
));
$options = array(
'http' => array (
'method' => 'POST',
'ignore_errors' => true,
'content' => $data
)
);
$result = file_get_contents($url, false, $options);
On my server where the code is in ruby
, I receive the parameters as
Parameters: {"conditions"=>{"1"=>{"0"=>"jd", "1"=>{"c"=>"d", "a"=>"b"}, "2"=>"equal"}, "0"=>{"0"=>"id", "1"=>"1", "2"=>"equal"}}
While I would like to receive
Parameters: {"conditions"=>[["id", "1", "equal"], ["jd", {"c"=>"d", "a"=>"b"}, "equal"]]
What can I do? Do I need to use an other way to send my datas?
Upvotes: 1
Views: 80
Reputation: 26013
Send them with JSON instead? This maintains the integrity of the entire array.
Upvotes: 1