网址错误0:cURL请求已重试3次,但未成功 [英] URL error 0: The cURL request was retried 3 times and did not succeed

查看:1814
本文介绍了网址错误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.

错误:

Error:


消息:cURL错误0:cURL请求被重试3次,
没有成功。失败的最可能原因是cURL是
无法倒回请求的主体,后续重试
导致相同的错误。打开调试选项查看
错误。请参阅 https://bugs.php.net/bug.php?id=47204获取更多信息。
(参见 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云端硬盘应用时,经过数小时的努力寻找解决方案,我使用GuzzleHttp接收器选项工作。

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);

值得一试。

这篇关于网址错误0:cURL请求已重试3次,但未成功的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆