Call a web service through php -


this question has answer here:

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

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -