Parsing response from a HTTP web service (JSON) in PHP -


i need consume http web service response in json format. how can achieve in php given url of web service known ?

this should do:

$data = file_get_contents(<url of website>); $data = json_decode($data, true); // turns array, change last argument false make object 

this should able turn json data array.

now, explain does.

file_get_contents() gets contents of file, either remote or local. through http portal, not violating privacy policy using function remote content.

then, when use json_decode(), changes json text object in php, since added true second argument, returns associative array instead.

then can array.

have fun!


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -