$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);
Ви також curlможете отримати URL-адресу. Щоб використовувати curl, ви можете використовувати приклад, знайдений тут :
$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)повинні зробити трюк