URL 错误 0:cURL 请求重试了 3 次,没有成功
我正在开发一个托管在 Google App Engine 上的项目,并使用 app_devserver 进行本地开发.一开始我遇到了证书问题,但是当我终于克服了这个错误时,我得到了这个新错误
I am working on a project that is hosted on Google App Engine, and using app_devserver for local development. At the start I had problems with certificates but when I finally got over that error I am getting this new error
我正在使用 Windows 10 和 PHPstorm 进行开发.
I am using Windows 10 and PHPstorm for development.
错误:
消息:cURL 错误 0:cURL 请求已重试 3 次并成功不成功.失败的最可能原因是 cURL无法回退请求正文和后续重试导致了同样的错误.打开调试选项看看发生了什么错误的.请参阅 https://bugs.php.net/bug.php?id=47204 了解更多信息.(见 http://curl.haxx.se/libcurl/c/libcurl-错误.html)
Message: 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)
看起来这个错误表示请求已成功发出,但无法解析或解析正文?我该如何解决?
Looks like this error is saying that the request is made and successfull but the body could not be resolved or parsed? How can I resolve it?
如果需要,这是我的 PHP 代码:(对标签管理器 api v2 的简单调用)
This is my PHP code if needed: (simple call to tag manager api v2)
$client = new Google_Client();
$client->setAuthConfig('service_account.json');
$client->setApplicationName("gtmdocx");
/*$client->setScopes(['https://www.googleapis.com/auth/tagmanager.readonly',
'https://www.googleapis.com/auth/tagmanager.manage.accounts',
'https://www.googleapis.com/auth/tagmanager.edit.containers']);*/
$client->setScopes(['https://www.googleapis.com/auth/tagmanager.readonly']);
$service = new Google_Service_TagManager($client);
$results = $service->accounts->listAccounts();
echo $_GET['callback'] . '('.json_encode($results).')';
推荐答案
我在使用 Google Drive 应用程序时遇到了这个问题,经过数小时试图找到解决方案,我使用 GuzzleHttp sink 选项让它工作
I had exactly this problem using the Google Drive app, after hours trying to find a solution, I got it to work using the GuzzleHttp sink option
$client = new Google_Client();
// ... Client Configuration
$httpClient = new Client([
'sink' => 'path_to_any_temp_file',
'base_uri' => $client->getConfig('base_path'),
]);
$client->setHttpClient($httpClient);
值得一试.
相关文章