Call a web service through php -
this question has answer here:
- helping using json api 3 answers
i new php. trying call web service (written in java) in following format url:
http://geoserver.com/track?uid='user'&sdate='sdatetime'&edate='edate' 'etime'
it returning json data in following format:
[{"lat":"1","lng":"2","time":"2013-06-23 14:00:42"}, {"lat":"3","lng":"4","time":"2013-06-23 14:10:10"}, {"lat":"5","lng":"6","time":"2013-06-23 14:21:00"}]
how can call url through php?
there couple of ways call using php. 1 method using curl
, method using file_get_contents
if using file_get_contents
$json = file_get_contents("http://geoserver.com/track?uid='user'&sdate='sdatetime'&edate='edateetime'"); $output = json_decode($json); //you can access $output[0]->lat; //your object properties way.
Comments
Post a Comment