GuzzleHttp \ Client :: send()必须实现接口Psr \ Http \ Message \ RequestInterface,GuzzleHttp \ Psr7的实例\给出的响应
尝试过没有运气的修改。
$request = $client->request('GET', $url, [
'timeout' => 15,
'exceptions' => false,
'keepalive' => true
]);
$response = $client->send($request);
$body = $response->getBody();
$content = $body ? $body->getContents() : '';
$code = $response->getStatusCode();
我希望发送请求成功发送。然而,由于喷嘴6的变化,它没有按预期工作。
您无需手动调用->send()
,实际请求已在->request()
内完成。这就是为什么你在错误中看到GuzzleHttp\Psr7\Response
。
所以只需删除发送行就可以了。
$response = $client->request('GET', $url, [
'timeout' => 15,
'exceptions' => false,
'keepalive' => true
]);
$body = $response->getBody();
$content = $body ? $body->getContents() : '';
$code = $response->getStatusCode();