CURLOPT_NOPROXY在PHP中不受影响 [英] CURLOPT_NOPROXY does not affect in PHP

查看:517
本文介绍了CURLOPT_NOPROXY在PHP中不受影响的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Ubuntu计算机上的/ etc / environment中有http_proxy设置。我已将CURLOPT_NOPROXY定义为10177,然后执行

I have http_proxy settings in my /etc/environment on my Ubuntu machine. I have defined CURLOPT_NOPROXY as 10177 and then do

$curl = curl_init('htpp://127.0.0.1:4444/wd/hub');
curl_setopt($curl, CURLOPT_NOPROXY, '127.0.0.1'); // or '*'
// ... set others params and options ...
curl_exec($curl);

但这不影响我的脚本,我收到代理错误消息,而不是WebDriver响应。同时从命令行使用 curl --noproxy 127.0.0.1 http://127.0.0.1:4444/wd/hub 很好。

But this does not affect my script and I receive proxy error message instead of WebDriver response. At the same time using curl --noproxy 127.0.0.1 http://127.0.0.1:4444/wd/hub from command line works well.

其他环境信息:

curl --version
curl 7.22.0 (x86_64-pc-linux-gnu) 
libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 
libidn/1.23 librtmp/2.3 
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtmp rtsp smtp smtps telnet tftp 
Features: GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP 

PHP版本是5.3.10。

PHP version is 5.3.10.

如何从PHP脚本设置noproxy选项?

How can I set up noproxy option from my PHP script?

UPDATED:看起来应该可以正常工作 https://bugs.php.net/bug.php?id = 53543 在PHP。

UPDATED: Looks like it should work https://bugs.php.net/bug.php?id=53543 in PHP.

推荐答案

我也有一个问题curl使用代理只在PHP curl调用。我最终发现SUSE特别是SLES 11设置了一些代理值。更改这些代理值修复了linux中的问题,但是我不得不重新启动整个服务器,而不仅仅是apache,使更改在PHP中生效。我使用YAST来更改服务器上的代理值。

I also had a problem with curl using a proxy only in PHP curl calls. I eventually found that SUSE specifically SLES 11 had some proxy values set. Changing those proxy values fixed issues in linux but I had to restart the entire server not just apache for the changes to take affect in PHP. I used YAST to change the proxy values on the server.

这篇关于CURLOPT_NOPROXY在PHP中不受影响的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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