PddToken is not a GET parameter, but a custom header.
Through file_get_contents additional control over HTTP requests can be obtained through the stream mechanism. For example,
$opts = array( 'http'=>array( 'method'=>"GET", 'header'=>"PddToken: 123456789ABCDEF0000000000000000000000000000000000000" ) ); $context = stream_context_create($opts); $response = file_get_contents('https://pddimp.yandex.ru/api2/admin/deputy/list?domain=mgtcontrol.ru', false, $context); var_dump($response);
I get a logical answer
{"domain": "mgtcontrol.ru", "success": "error", "error": "bad_token"}
This is no longer no_auth , it is a logical answer about the wrong token.
Or, as usual, use curl to interact.
$ch = curl_init('https://pddimp.yandex.ru/api2/admin/deputy/list?domain=mgtcontrol.ru'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ 'PddToken: 123456789ABCDEF0000000000000000000000000000000000000' ], ]); $response = curl_exec($ch); var_dump($response);
file_get_contentsreads the contents of a file into a string, rather than sending a request. We read xhr or use ajax through jquery or its short methods$.get,$.post,$.load. Or even use the form via html for get request - Mr. Black