$json = file_get_contents('url_here'); $obj = json_decode($json); echo $obj->access_token;
For this, file_get_contents requires allow_url_fopen be enabled. This can be done at runtime by including:
ini_set("allow_url_fopen", 1);
You can also use curl to get the url. To use curl, you can use the example found here :
$ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_URL, 'url_here'); $result = curl_exec($ch); curl_close($ch); $obj = json_decode($result); echo $obj->access_token;
Prisoner Mar 25 '13 at 14:33 2013-03-25 14:33
source share