PHP致命错误:未捕获的GuzzleHttp\Exception\ClientException:客户端错误:`GET导致了`401 Unauthorized`响应

PHP致命错误:未捕获的GuzzleHttp\Exception\ClientException:客户端错误:`GET导致了`401 Unauthorized`响应,php,guzzle,Php,Guzzle,我请求: <?php require_once 'vendor/autoload.php'; use GuzzleHttp\Client; $client = new Client(); $response = $client->get('https://id.ati.su/api/auth/?encode=true'); print $body = $response->getBody(); Response: PHP Fatal error: Uncaugh

我请求:

<?php

require_once 'vendor/autoload.php';

use GuzzleHttp\Client;

$client = new Client();

$response = $client->get('https://id.ati.su/api/auth/?encode=true');

print $body = $response->getBody();


Response: PHP Fatal error:  Uncaught GuzzleHttp\Exception\ClientException: Client error: `GET https://id.ati.su/api/auth/?encode=true` resulted in a `401 Unauthorized` response: {"error":"session_over","reason":"Введите логин и пароль","device_id":"2hGMvMg7ddOKyOo%2BCk5TJVSmYcDS (truncated...)  in /home/bity/Документы/000_projects/ati/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113 Stack trace:
#0 /home/bity/Документы/000_projects/ati/vendor/guzzlehttp/guzzle/src/Middleware.php(69): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response), NULL, Array, NULL)
#1 /home/bity/Документы/000_projects/ati/vendor/guzzlehttp/promises/src/Promise.php(204): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response))
#2 /home/bity/Документы/000_projects/ati/vendor/guzzlehttp/promises/src/Promise.php(153): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), NULL)
#3 /home/bity/Док in /home/bity/Документы/000_projects/ati/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 113


您会收到401错误,这意味着:未经授权,您可能需要用户和密码