I have a URL that returns a JSON object like this:
{"ip":"192.168.48.68"}
I want to get the ip
value. So how can I retrieve it through PHP?
I have a URL that returns a JSON object like this:
{"ip":"192.168.48.68"}
I want to get the ip
value. So how can I retrieve it through PHP?
use the json_decode
method:
$json = YOUR_JSON_OBJECT;
$ip = json_decode($json, true);
//then you can get the ip using its index in the array
$ip["ip"] //192.168.48.68