
Teach you how to use curl to hang a proxy to access the Internet.
Today we nag programmers most commonly used curl command how to hang proxy, especially for the need to frequently switch IP data collection old iron. Don't rush to knock the code first, you have to realize thatproxy server addressformat: typically something like http://ip:port或者http://user:pass@ip:port with authentication.
Curl proxy parameter core play
Remember these two pro-brother parameters:
– -x is easy mode (example: curl -x 112.95.161.201:8008 http://example.com)
– -proxy is the full schema (example: curl -proxy http://user001:abcd1234@proxy.ipipgo.io:8899 https://target.com)
| take | Recommended parameters |
|---|---|
| ad hoc test | -x Parameters |
| Formal environment | -proxy + authentication information |
Sample code
Basic usage (test node with ipipgo)
curl -x http://try.ipipgo.io:8080 https://httpbin.org/ip
With account authentication (remember to switch to the package you bought)
curl --proxy-user vipuser:2024best --proxy http://proxy.ipipgo.io:8899 https://target-site.com/data.json
Timeout settings (to prevent jamming)
curl --proxy http://proxy.ipipgo.io:8899 --max-time 30 https://slow-server.com
Guide to avoiding the pit
Newbies often plant themselves in these places:
1. mix up agreements: http proxy can't access https website, you have to use proxy package that supports https.
2. The port is written incorrectly.The default business port for ipipgo is 8899/8900, don't use anything else!
3. have no time-outs: It's safest to add a -max-time of 20 when the network is jerking around.
QA First Aid Kit
Q: What should I do if I can't connect to the agent?
A: first ping down the proxy address, and then use telnet to measure the port pass or fail. ipipgo's nodes support online detection function, the official website background can check the real-time status.
Q: What should I do if my IP is frequently blocked?
A: change into ipipgo's dynamic residential agent, every request automatically change IP, personally tested the collection of an e-commerce platform data for three consecutive days did not turn over.
Q: Return 407 authentication error?
A:密码里有特殊符号的话要用URL编码,比如@换成%40,建议直接找ipipgo客服要现成的认证字符串。
Why ipipgo?
The in-house real-world data speaks for itself:
- Millisecond response: 2-3 times faster than common agents on the market
- Exclusive IP pools: don't crash with others
- Intelligent routing: automatic selection of the fastest node
New subscribers receive a 3G traffic trial package, enough to run through the business process before deciding to buy a package or not.
One last tawdry maneuver: write the proxy configuration as an alias and throw it into .bashrc, for examplealias curlp='curl --proxy http://$IPIPGO_PROXY'The use of the direct curlp plus the URL, save a lot of work to fly. What do not understand the comment section see, see will return.

