URL错误0:cURL请求被重试3次,但未成功

问题描述:

我正在研究一个托管在Google App Engine上的项目,并使用app_devserver进行本地开发。在开始时我遇到了证书问题,但是当我终于知道这个错误时,我得到了这个新错误URL错误0:cURL请求被重试3次,但未成功

我正在使用Windows 10和PHPstorm进行开发。

错误:

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)

貌似这个错误是说,提出要求和全成,但身体不能得到解决或分析?我该如何解决它?

这是我的PHP代码,如果需要的话:(简单的调用标签管理器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).')'; 
+0

你有没有想过这个?我与谷歌API有同样的问题。 – TheValyreanGroup

+0

@TheValyreanGroup您使用的是哪种操作系统,以及IDE? – Asim

+0

Windows和没有ide。 – TheValyreanGroup

我不得不使用谷歌云端硬盘应用正是这个问题,几个小时试图找到一个解决方案后,我得到了它使用GuzzleHttp接收器选项工作

$client = new \Google_Client(); 
// ... Client Configuration 

$httpClient = new Client([ 
    'sink' => 'path_to_any_temp_file', 
    'base_uri' => $client->getConfig('base_path'), 
]); 
$client->setHttpClient($httpClient); 

值得一试。

+0

非常好!经过几个小时的搜索和调试,我发现了根本原因,并且I️最终直接修改了Guzzles源文件以使用temp.txt文件。这显然好多了。 – TheValyreanGroup