0

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?

1 Answers1

2

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
Gopakumar Gopalan
  • 1,187
  • 14
  • 22
Dylan Bourdere
  • 105
  • 2
  • 10