0

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?

0

2 Answers 2

2

I don't want to give you the solution, so the below should be enough to get you started.

  1. Read in the JSON data using file_get_contents
  2. 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);
Sign up to request clarification or add additional context in comments.

Comments

1

You mean something like this?

<?php

$jsonurl = "http://search.twitter.com/trends.json";
$json = file_get_contents($jsonurl,0,null,null);
$json_output = json_decode($json);

foreach ( $json_output->trends as $trend )
{
    echo "{$trend->name}\n";
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.