Guzzle在有效URL上返回404
我正在使用Guzzle和CurlAuthPlugin进行身份验证。当我运行代码时,我得到Guzzle在有效URL上返回404,guzzle,Guzzle,我正在使用Guzzle和CurlAuthPlugin进行身份验证。当我运行代码时,我得到 Client error response\ [status code] 404\ [reason phrase] Not Found\ [url] https:\/\/api.buto.tv\/v2\/video\/tag\/v2\/video\/tag\/ 我使用的代码是: $client = new Client(<URL>); // Add the auth plugin t
Client error response\ [status code] 404\ [reason phrase] Not Found\ [url] https:\/\/api.buto.tv\/v2\/video\/tag\/v2\/video\/tag\/
我使用的代码是:
$client = new Client(<URL>);
// Add the auth plugin to the client object
$authPlugin = new CurlAuthPlugin(<APIKEY>, 'x');
$client->addSubscriber($authPlugin);
$response = $client->get('v2/video/tag/')->send();
但我也犯了同样的错误。我已经用
echo$request->getUrl()输出了它请求的URL
如果我将URL复制并粘贴到浏览器中,则URL很好我认为您可能在api.buto.tv之后缺少斜杠“/”,因此URL解析为“”而不是“”
甚至我也有同样的问题。我使用的浏览器很好。但不是在狂饮。这可能是禁用cookie的问题。或者网站上实施的一些安全功能。
$client = new Client('https://api.buto.tv');
$request = $client->get('v2/video/tag/');
$request->setAuth('user', 'pass');
$response = $request->send();
$client = new Client('https://api.buto.tv/');
$request = $client->get('v2/video/tag/');