cURL请求重试3次没有成功
The cURL request was retried 3 times and did not succeed
我目前正在使用(Guzzle 客户端/Laravel)开发一个自定义 API 的休息 API 调用。我已经通过添加错误的主体尝试了几次。我收到以下错误
cURL error 0: The cURL request was retried 3 times and did not succeed. The most likely reason for the failure is that cURL was unable to rewind the body of the request and subsequent retries resulted in the same error. Turn on the debug option to see what went wrong. See https://bugs.php.net/bug.php?id=47204 for more information. (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
以下是我的开发环境的详细信息:
Language : php,
Framework : Laravel 5.4,
Client : Guzzle,
OS : Ubuntu 16.04
我想知道这背后的原因
请协助我处理此事,
谢谢
以下是我的代码
{
$headers = [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer '.$this->accessTocken,
'Accept' => 'application/json',
];
$Body = [
'method' => 'AndroidApp',
'msisdn' => '94777400725',
];
$client = new Client();
$response = $client->post( $this->url, ['headers'=> $headers,
'json'=> $Body]);
}
$response->getBody()->rewind();
对我有用
我目前正在使用(Guzzle 客户端/Laravel)开发一个自定义 API 的休息 API 调用。我已经通过添加错误的主体尝试了几次。我收到以下错误
cURL error 0: The cURL request was retried 3 times and did not succeed. The most likely reason for the failure is that cURL was unable to rewind the body of the request and subsequent retries resulted in the same error. Turn on the debug option to see what went wrong. See https://bugs.php.net/bug.php?id=47204 for more information. (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
以下是我的开发环境的详细信息:
Language : php,
Framework : Laravel 5.4,
Client : Guzzle,
OS : Ubuntu 16.04
我想知道这背后的原因
请协助我处理此事,
谢谢
以下是我的代码
{
$headers = [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer '.$this->accessTocken,
'Accept' => 'application/json',
];
$Body = [
'method' => 'AndroidApp',
'msisdn' => '94777400725',
];
$client = new Client();
$response = $client->post( $this->url, ['headers'=> $headers,
'json'=> $Body]);
}
$response->getBody()->rewind();
对我有用