当前位置: 首页 > 知识库问答 >
问题:

60 %的请求给出curl错误url错误7:连接失败

仲孙鸿畴
2023-03-14

该错误是间歇性的,有时它有效,有时它不起作用,这使得调试非常困难。

  • 机器:视窗 10
  • 框架:拉拉维尔5.1
  • 环境:
    • 家园 2.2.1
    • Vagrant 1.8.1 (Ubuntu 14.04.2 LTS GNU/Linux 3.13.0-32-generic x86_64)
    • 5.6.10-1 deb.sury.org
    • “咕噜咕噜/咕噜”: 6.1.1,
    • “get-stream/stream-laravel”: “dev-master”,
    ConnectException in CurlFactory.php line 186:
    cURL error 7: Failed to connect to us-east-api.getstream.io port 443: Connection timed out (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
    
    in CurlFactory.php line 186
    at CurlFactory::createRejection(object(EasyHandle), array('errno' => '7', 'error' => 'Failed to connect to us-east-api.getstream.io port 443: Connection timed out', 'url' => 'https://us-east-api.getstream.io/api/v1.0/feed/notification/1/?limit=7&api_key=XXX', 'content_type' => null, 'http_code' => '0', 'header_size' => '0', 'request_size' => '0', 'filetime' => '-1', 'ssl_verify_result' => '0', 'redirect_count' => '0', 'total_time' => '4.077293', 'namelookup_time' => '0.127791', 'connect_time' => '0', 'pretransfer_time' => '0', 'size_upload' => '0', 'size_download' => '0', 'speed_download' => '0', 'speed_upload' => '0', 'download_content_length' => '-1', 'upload_content_length' => '-1', 'starttransfer_time' => '0', 'redirect_time' => '0', 'redirect_url' => '', 'primary_ip' => '', 'certinfo' => array(), 'primary_port' => '0', 'local_ip' => '', 'local_port' => '0')) in CurlFactory.php line 150
    at CurlFactory::finishError(object(CurlHandler), object(EasyHandle), object(CurlFactory)) in CurlFactory.php line 103
    at CurlFactory::finish(object(CurlHandler), object(EasyHandle), object(CurlFactory)) in CurlHandler.php line 43
    at CurlHandler->__invoke(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'timeout' => '6', 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in Proxy.php line 28
    at Proxy::GuzzleHttp\Handler\{closure}(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'timeout' => '6', 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in Proxy.php line 51
    at Proxy::GuzzleHttp\Handler\{closure}(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'timeout' => '6', 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in PrepareBodyMiddleware.php line 42
    at PrepareBodyMiddleware->__invoke(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'timeout' => '6', 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in Middleware.php line 30
    at Middleware::GuzzleHttp\{closure}(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'timeout' => '6', 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in RedirectMiddleware.php line 68
    at RedirectMiddleware->__invoke(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'timeout' => '6', 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in Middleware.php line 59
    at Middleware::GuzzleHttp\{closure}(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'timeout' => '6', 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in HandlerStack.php line 67
    at HandlerStack->__invoke(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'timeout' => '6', 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false)) in Client.php line 268
    at Client->transfer(object(Request), array('synchronous' => true, 'base_uri' => object(Uri), 'timeout' => '6', 'handler' => object(HandlerStack), 'allow_redirects' => array('max' => '5', 'protocols' => array('http', 'https'), 'strict' => false, 'referer' => false, 'track_redirects' => false), 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false, '_conditional' => array('User-Agent' => 'GuzzleHttp/6.1.1 curl/7.35.0 PHP/5.6.10-1+deb.sury.org~trusty+1'))) in Client.php line 98

共有1个答案

索和璧
2023-03-14

作为Stream的联合创始人之一,我可以告诉你,在我们这一端,事情进展顺利:)您也可以从 Stream 的状态页面进行验证。

您遇到的超时错误可能取决于很多事情。以下两个是类似问题的最常见原因:

>

  • 本地开发人员和我们的APIendpoint之间的连接延迟缓慢/不一致

    DNS问题(如DNS TTL处理错误、DNS服务器损坏等)

    我的建议是通过以下方式确保两者都得到照顾:

    > < li>

    为您的开发环境增加API超时,在stream-laravel配置文件中确保您有< code>'timeout' =

    确保你使用像谷歌DNS这样的东西(它们工作得很好),IP是8.8.8.88.8.4.4由于Homestead使用Ubuntu,你可以参考这个链接

  •  类似资料:
    • 我正在为一个项目使用Hackerrank API。查看官方文档,点击这里! 在他们的网站上有一个使用UNIREST的例子, 由于我使用的是axios,所以我将其转换为类似的axios代码,如下所示: 我希望这只适用于示例中所示的示例,但它给我带来了以下错误: 请求失败,状态代码为400 错误:请求失败,状态代码为400 在createError(createError.js:16) 在sett(s

    • 我有l5.2,我按照以下步骤钩住spikpost和laravel,并将我的服务和恢复到其原始配置: 但是我得到了这个错误: cURL错误60:SSL证书问题:无法获取本地颁发者证书(请参阅http://curl.haxx.se/libcurl/c/libcurl-errors.html)

    • 当我试图在windows上设置一个PHP环境(使用wamp)来使用Amazon PHP SDK时,当我试图运行一个示例测试时,我得到以下错误: 我已经添加了以下行到我的php.ini 这是我使用此VBS脚本创建的证书的位置 我也重新启动了WAMP服务。

    • 我想摆脱这个错误。我读到一个类似的问题,其中一个答案建议我可以使用以下命令禁用验证: 我的确切错误是: 在C:\ path \ guzzle \ src \ Handler \ cURL factory . PHP:187堆栈跟踪:# 0 C:\ path \ guzzle \ src \ Handler \ cURL factory . PHP:187堆栈跟踪:# 0 C:\ path \ gu

    • 问题内容: 我遇到这个奇怪的错误, CURL错误:接收失败:对等连接重置 如果我没有连接到服务器,而突然尝试通过PHP中的CURL连接到服务器,则会出现此错误。当我再次运行CURL脚本时,错误消失,然后在整个过程中都正常运行,如果我将远程服务器保持空闲状态约30分钟或重新启动远程服务器并尝试重新连接,则我会再次收到该错误。因此,似乎连接处于空闲状态,然后突然服务器唤醒,然后工作,然后再次进入睡眠状