php 使用curl 代理访问报错:Operation timed out after 0 milliseconds with 0 out of 0 bytes received
来源:互联网 发布:xmind中文破解版 mac 编辑:程序博客网 时间:2024/06/08 08:41
对应的curl代码如下:
出现报错Operation timed out after 0 milliseconds with 0 out of 0 bytes received
$ch = curl_init();curl_setopt ($ch, CURLOPT_PROXY, $proxy);curl_setopt ($ch, CURLOPT_URL, $url);curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent);curl_setopt ($ch, CURLOPT_COOKIEJAR, "c:\cookie.txt");curl_setopt ($ch, CURLOPT_HEADER, 1);curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);curl_setopt ($ch, CURLOPT_TIMEOUT, 120);$result = curl_exec ($ch);curl_close($ch);return $result;
或者
$curl=curl_init();curl_setopt($curl,CURLOPT_URL, "https://www.lvtao.net");curl_setopt($curl,CURLOPT_HEADER,1);curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);curl_setopt($curl,CURLOPT_POST,1);curl_setopt($curl,CURLOPT_PROXYTYPE,CURLPROXY_SOCKS5);//使用了SOCKS5代理curl_setopt($curl, CURLOPT_PROXY, "ip:1080"); $data = array('user' => "geek", 'password' => 'fuck');curl_setopt($curl, CURLOPT_POSTFIELDS, $data);//curl_setopt($curl, CURLOPT_HTTPPROXYTUNNEL, 1);如果是HTTP代理//curl_setopt($curl, CURLOPT_COOKIEJAR, 'cookie.txt');cookie你懂的$request = curl_exec($curl);//var_dump($request);curl_close($curl);
可能是ssl版本问题
$ch=curl_init();curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);curl_setopt($ch, CURLOPT_SSLVERSION, 3);
curl 、wget使用代理
命令使用代理
wget/curl 都支持使用代理
wget -e “http_proxy=10.1.4.43:8080″ proxy.mimvp.com
curl -x 10.1.4.43:8080 proxy.mimvp.com
环境变量使用代理
curl、wget也支持通过环境变量http_proxy来设置要使用的代理服务器, 如下:
这个帐号使用的代理服务器
http_proxy=”http://mycache.mydomain.com:3128″
export http_proxy
如果代理服务器需要用户名和密码,只要将它们加入 URL。
例如:用户名 myuser,密码 mypwd,添加设定:
这个帐号使用的代理服务器和用户名/密码
http_proxy=”http://myuser:mypwd@mycache.mydomain.com:3128″
export http_proxy
然后直接wget proxy.mimvp.com 或者curl proxy.mimvp.com
阅读全文
0 0
- php 使用curl 代理访问报错:Operation timed out after 0 milliseconds with 0 out of 0 bytes received
- JMS response timed out after 20000 milliseconds (Response Timeout Period)
- memcached Timed out(x milliseconds) waiting for operation while connecte的排查过程
- Nginx报错:upstream timed out (110: Connection timed out)
- Nginx报错:upstream timed out (110: Connection timed out)
- nrpe 报错 Received 0 bytes from daemon
- 使用maven创建java项目报错connect timed out
- python django安装报错The read operation timed out(pytz)
- 安装Tensorflow超时报错:socket.timeout: The read operation timed out
- Selenium IDE 报错 Timed out after 50000ms 或 Element ...... not found
- lucene报错Lock obtain timed out:
- pip报错:Read timed out.
- 【技术支持】Oracle报连接超时,TNS-12535:TNS:operation timed out。WARNING: inbound connection timed out (ORA-3136)
- 打开oracle时报错:ORA-12535:TNS:operation timed out
- cc1: out of memory allocating 3355443200 bytes after a total of 610304 bytes
- curl: (7) Failed to connect to raw.githubusercontent.com port 443: Operation timed out
- [转载] ORA-12535: TNS:operation timed out
- SSRS throws "The operation has timed out."
- 阿里云ecs安全组引发的血案
- 深度学习算法工程经验
- struts2 ActionWildCard 通配符配置
- Menu 基础知识
- java多线程系列—基础概念
- php 使用curl 代理访问报错:Operation timed out after 0 milliseconds with 0 out of 0 bytes received
- 操作系统镜像文件ucore.img是如何一步一步生成的
- H5APP开发(一):简单计算器(使用Hbuild)
- react与vue
- 记录ubuntu上安装git后,ssh连接不上
- 关于C#上传文件出现UnauthorizedAccessException解决办法
- 前后台$.post交互并返回JSON对象
- tcp_server的实现
- python学习日记:图像模糊