【问题标题】:Error H12 (Request timeout) on script but not on browser脚本上的错误 H12(请求超时)但浏览器上没有
【发布时间】:2012-08-19 00:48:51
【问题描述】:

我有一个调用 ruby​​ on rails web 服务器的 php 脚本。此 Web 服务器旨在成为女巫上的 api 服务器,我将从 php 脚本进行多次调用。

我已经创建了一个测试路由/api/test,看看我的脚本能否成功调用我的api服务器。

在开发中一切正常,没有发现任何问题。但是今天,当我将它上传到 heroku 时,我得到了Error H12 (Request timeout)

所以我在浏览器上打开了相同的网址。在浏览器中我看不到任何错误,并且页面已按应有的方式加载。

我的 php 脚本是这样的:

    $ch = curl_init($url);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $http_method); // GET, POST, PUT and DELETE, one at the time
curl_setopt($ch, CURLOPT_HTTPHEADER, $header_fields);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

return $response;

这是错误日志,顺便说一下,有时 GET 请求甚至不会显示为错误或成功:

2012-08-23T13:28:07+00:00 heroku[router]: Error H12 (Request timeout) -> POST *.herokuapp.com/api/test dyno=web.1 queue= wait= service=30000ms status=503 bytes=0
2012-08-23T13:28:08+00:00 heroku[router]: Error H12 (Request timeout) -> PUT *.herokuapp.com/api/test dyno=web.1 queue= wait= service=30000ms status=503 bytes=0
2012-08-23T13:28:09+00:00 heroku[router]: Error H12 (Request timeout) -> DELETE *.herokuapp.com/api/test dyno=web.1 queue= wait= service=30000ms status=503 bytes=0

有时 4 个请求中的一个会返回一些东西,但就像不小心一样

有人可以帮助我吗?我真的需要这个脚本工作

【问题讨论】:

    标签: php ruby-on-rails heroku libcurl


    【解决方案1】:

    找到问题了。

    这是我公司的防火墙。

    不知道在哪里,但是一旦我的机器摆脱了限制,它现在就可以工作了

    【讨论】:

      猜你喜欢
      • 2018-10-10
      • 1970-01-01
      • 2012-06-14
      • 2012-07-08
      • 2020-01-26
      • 1970-01-01
      • 2017-07-16
      • 2016-12-19
      • 2021-12-07
      相关资源
      最近更新 更多