http://www.instamapper.com/api?action=getPositions&key=584014439054448247&num=10&format=json is the url, which contains json data. I want to use that data and send SMS to a particular phone no if value of latitude and longitude(Extracted from JSON). Check constraints, we can use through php. But the main problem is How to extract data from JSON file?
2 Answers
I don't want to give you the solution, so the below should be enough to get you started.
- Read in the JSON data using
file_get_contents - Parse the JSON string into a PHP object using
json_decode
Your code should look something like this:
$url = "http://www.instamapper.com/api?action=getPositions&key=584014439054448247&num=10&format=json";
$contents = file_get_contents($url);
$jsonObj = json_decode($contents);