dongyou7472 2011-12-09 10:47
浏览 1392

当尝试使用代理打开URL时,CURLE_RECV_ERROR 56

I have been trying to send curl requests with a proxy. When I send such requests with a POST method, it works fine, but it doesn't work with GET method and I get:

CURLE_RECV_ERROR (56) - Failure when receiving data from the peer.

Any possible reason why that occurs?

The below code returns this error whereas when I execute it with another url using POST METHOD it works fine.

$handle = curl_init($url);
curl_setopt($handle, CURLOPT_POST          , 0);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_HEADER        , 1);
curl_setopt($handle, CURLOPT_MAXREDIRS     , 5);
curl_setopt($handle, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($handle, CURLOPT_USERAGENT     , 'Mozilla/5.0 (Windows; U; Windows NT   5.1; en-GB; rv:1.9.1.4) Gecko/20091016 Firefox/3.5.4');
// curl_setopt($handle, CURLOPT_POSTFIELDS    , "gender=M");
curl_setopt($handle,CURLOPT_PROXY          , $proxyUrl);
curl_setopt($handle,CURLOPT_PROXYUSERPWD   , $urlProxyUserPwd);

echo curl_exec($handle);
  • 写回答

2条回答 默认 最新

  • douzi9430 2011-12-09 11:29
    关注

    Are you always sending requests to a particular server, or it happens always, for different servers?

    It is quite possible that the proxy in question requires data to be sent using POST method, instead of GET method.

    If you could give us more info, perhaps some error log, we could be of more help.

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退
  • ¥20 win系统的PYQT程序生成的数据如何放入云服务器阿里云window版?
  • ¥50 invest生境质量模块
  • ¥15 nhanes加权logistic回归,svyglm函数