Teach you to use curl to go proxy ip by hand
Brothers engaged in network development must have dealt with curl, but encountered the need to hang the proxy scene is a bit confused. Today we do not talk about false, directly on the hard food, teach you how to in the command line to curl set proxy ip. here recommended!ipipgoThe agency service of the family, the stability of the real test hangs on the peer.
Core parameters for curl walk proxies
Remember this universal formula:-x Or the full name-proxy. For example, to use ipipgo's HTTP proxy, the format looks like this:
curl -x http://user:pass@proxy.ipipgo.cn:8080 https://目标网站
Watch this space.user:passTo change to their own in the ipipgo background to get the authentication information, do not directly copy me this ah! The port number also depends on the specific package, either 8080 or 9021.
Special handling of HTTPS requests
In cases where you need to go to an HTTPS proxy, you have to switch to the-proxyparameter in conjunction with an environment variable:
export https_proxy=http://user:pass@proxy.ipipgo.cn:8081
curl --proxy $https_proxy https://加密网站
Here's a pitfall to watch out for:ipipgo's HTTPS proxy port is separate from HTTPDon't get confused. If it returns a certificate error, try adding-kparameter temporarily skips validation.
Practical Tips and Tricks
1. session mode: Save time with this position for frequent calls!
export http_proxy=http://user:pass@proxy.ipipgo.cn:8080
export https_proxy=$http_proxy
2. timeout setting: Avoid jamming plus insurance
curl -x http://代理地址 --max-time 30 url
3. debugger: Add the -v parameter if you want to see the detailed process.
Agent Type Comparison Table
Agent Type | Applicable Scenarios | ipipgo packages |
---|---|---|
Dynamic Residential IP | Frequent IP changes required | Speed Edition |
Static long-lasting IP | Requires stable connection | Enterprise Edition |
Mobile IP | Analog mobile access | cell phone line |
Frequently asked questions on demining
Q: Proxy setting is successful but not effective?
A: Check three elements first: IP address, port, and authentication information. It is recommended to usecurl -x proxy address ifconfig.me
Test Outlet IP
Q:Return 407 Agent Authentication Error?
A: Ninety-nine percent of the password is wrong, note that the ipipgo password contains special characters to add quotes
Q: How to switch multiple proxy IPs automatically?
A: You can write a shell script to poll the IP pool provided by ipipgo, with the API to dynamically obtain the latest proxy address
Why ipipgo?
Realistically, his family has three masterpieces:
1. Domestic self-built server room, latency lower than overseas agents 80%
2. Unique IP live technology, an IP can be used for a full 24 hours
3. fast after-sales response, last time at 3:00 a.m. to mention the work order actually seconds back!
And finally.Private Configuration: Write common proxies as aliases and throw them into the.bashrc
Li (surname)
alias curl-ipg="curl -x http://user:pass@proxy.ipipgo.cn:8080"
This way, future calls will be made directly tocurl-ipg URL
Finish up and save time and effort.