php file_get_contents json code example
Example 1: fetch value from json link in php
$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;
Example 2: file_get_contents('php //input')
Actually php:
It is a less memory intensive alternative to $HTTP_RAW_POST_DATA and does not need any special php.ini directives.
php:
Reference: http: