脚本上出现错误H12(请求超时),但浏览器上没有


Error H12 (Request timeout) on script but not on browser

我有一个php脚本,它可以调用ruby on rails web服务器。这个web服务器旨在成为witch上的api服务器,我将从php脚本进行几个调用。

我创建了一个测试路由/api/test,看看我的脚本是否可以成功地调用我的api服务器。

在开发方面,一切都很好,没有发现任何问题。但今天,当我把它上传到heroku时,我得到了Error H12 (Request timeout)

所以我在浏览器上打开了相同的url。在浏览器中,我看不到任何错误,页面是按照应该的方式加载的。

我的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个请求中的一个会返回一些东西,但就像是意外地

有人能帮我吗?我真的需要这个脚本运行

发现问题。

那是我公司的防火墙。

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