I got response from URL like this. I want value of sid
. How can I get this?
{"response": "success","body":{ "sid" : "5f255c86a", "role" : "user" }}
I got response from URL like this. I want value of sid
. How can I get this?
{"response": "success","body":{ "sid" : "5f255c86a", "role" : "user" }}
The above response looks to b JSON
so you can use json_decode()
function.
Try
$response = file_get_contents($url);
$json = json_decode($response);
echo $json->body->sid;
Note You need to replace $url
with URL of response page.