I have a php script that i use to send json to another server, but i need to get the return, but i'm not getting, how can i do this?
The return is a json too.
This code is working, but i'm not getting the return.
The return that i need is like this: {"Online":"true"}
$data = array(
"ServerId" => $data_server[2],
"ServerPath" => "/home/slsolucoes/MTA/",
"MaxPlayers" => $data_config[3],
"Port" => $data_server[3],
"HttpPort" => $data_server[3]
);
$options = array(
"http" => array(
"method" => "POST",
"content" => json_encode($data, JSON_UNESCAPED_SLASHES),
"header" => "Content-Type: application/json
"."Accept: application/json
"
)
);
$context = stream_context_create($options);
$result = file_get_contents($data_server[4], false, $context );
$response = json_decode($result);
echo($response);