当前位置:首页 > Web开发 > 正文

Linux Shell curl 和 wget 使用代办代理IP

2024-03-31 Web开发

Linux Shell 供给两个非常实用的命令来爬取网页,,它们分袂是 curl 和 wget

curl 和 wget 使用代办代理

curl 撑持 http、https、socks4、socks5

wget 撑持 http、https

代办代理示例:

#!/bin/bash # # curl 撑持 http、https、socks4、socks5 # wget 撑持 http、https # # 米扑代办代理示例: # # # 米扑代办代理采办: # # # mimvp.com # 2015-11-09 # http代办代理格局 http_proxy=http://IP:Port # https代办代理格局 https_proxy=http://IP:Port {‘http‘: ‘:8888‘} curl -m 30 --retry 3 -x :8888 # http_proxy wget -T 30 --tries 3 -e "http_proxy=http://120.77.176.179:8888" # http_proxy {‘https‘: ‘:3128‘} curl -m 30 --retry 3 --proxy-insecure -x :3128 -k https://proxy.mimvp.com/exist.php # https_proxy wget -T 30 --tries 3 --no-check-certificate -e "https_proxy=http://46.105.214.133:3128" https://proxy.mimvp.com/exist.php # https_proxy # curl 撑持socks {‘socks4‘: ‘101.255.17.145:1080‘} curl -m 30 --retry 3 --socks4 101.255.17.145:1080 {‘socks5‘: ‘82.164.233.227:45454‘} curl -m 30 --retry 3 --socks5 82.164.233.227:45454 # wget 不撑持socks

<br/>

wget 配置文件设置代办代理

vim ~/.wgetrc http_proxy=http://120.77.176.179:8888:8080 https_proxy=http://12.7.17.17:8888:8080 use_proxy = on wait = 30 wget -T 30 --tries 3

<br/>

Shell 设置姑且局部代办代理

# proxy no auth export http_proxy=http://120.77.176.179:8888:8080 export https_proxy=http://12.7.17.17:8888:8080 # proxy auth export http_proxy=http://username:[email protected]:8888:8080 export https_proxy=http://username:[email protected]:8888:8080 # 打消设置 unset http_proxy unset https_proxy

<br/>

Shell 设置系统全局代办代理

# 改削 /etc/profile,生存并重启处事器 sudo vim /etc/profile # 所有人有效 或 sudo vim ~/.bashrc # 所有人有效 或 vim ~/.bash_profile # 小我私家有效 # proxy no auth export http_proxy=http://120.77.176.179:8888:8080 export https_proxy=http://12.7.17.17:8888:8080 # proxy auth export http_proxy=http://username:[email protected]:8888:8080 export https_proxy=http://username:[email protected]:8888:8080 source /etc/profile 或 source ~/.bashrc 或 source ~/.bash_profile sudo reboot

<br/>

米扑代办代理示例

米扑代办代理示例,包罗Python、Java、PHP、C#、Go、Perl、Ruby、Shell、NodeJS、PhantomJS、Groovy、Delphi、易语言等十多种编程语言或脚本,通过大量的可运行实例,详细讲解了使用代办代理IP的正确要领,便利网页爬取、数据收罗、自动化测试等范围。

技术图片


米扑代办代理示例,测试使用的代办代理IP,全部来自于米扑代办代理,其笼罩120多个国家,中国34个省市,撑持http、https、socks4、socks5等
米扑代办代理示例官网 :

<br/>

参考保举
(保举)
mimvp-proxy-demo (GitHub)
Linux 抓取网页实例(shell+awk)
LinuxIP代办代理筛选系统(shell+proxy)

Linux Shell curl 和 wget 使用代办代理IP

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/31345.html