$json = file_get_contents('url_here');
$obj = json_decode($json);
echo $obj->access_token;
काम करने के लिए इस के लिए, file_get_contentsकी आवश्यकता है कि allow_url_fopenसक्षम है। यह रनटाइम में शामिल किया जा सकता है:
ini_set("allow_url_fopen", 1);
आप curlurl प्राप्त करने के लिए भी उपयोग कर सकते हैं । कर्ल का उपयोग करने के लिए, आप यहां दिए गए उदाहरण का उपयोग कर सकते हैं :
$ch = curl_init();
// IMPORTANT: the below line is a security risk, read https://paragonie.com/blog/2017/10/certainty-automated-cacert-pem-management-for-php-software
// in most cases, you should set it to true
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;
json_decode($your_string)चाल करना चाहिए