
Teach you how to use cURL to send JSON requests with a proxy
If you are a developer, you should have encountered this scenario: you want to send JSON data from the command line, but you have to do it through a proxy IP, which sounds simple, but in practice there are a lot of potholes. Today, let's talk about how to use cURL with proxy IP to handle JSON requests, and by the way, I'd like to introduce our ipipgo's useful functions.
Why do I have to use a proxy IP?
To give a realistic example: do crawl brothers know, directly with their own IP crazy request, minutes to be blocked by the site. At this time, the proxy IP is like the resurrection coins in the game, a new IP and can continue to work. Especially the need to send JSON data scenarios, such as simulation of registration, order submission of these sensitive operations, the use of proxy IP can effectively diversify the risk.
Three major benefits of proxy IPs:
- Stealth Mode: Real IPs are Hidden Tightly
- Unlimited renewal: IP blocked at any time for a new one
- Geographic camouflage: pick whatever IP you want!
Three Steps to Configure a Proxy for cURL
Let's first straighten out the basic proxy parameters for cURL:
curl -x proxy IP:port -H "Content-Type: application/json" -d '{"key": "value"}' Destination URL
Here's an easy place to plant your head:Don't confuse agency agreements.The first thing you need to do is to get your own proxy. For example, ipipgo's proxies support HTTP/HTTPS/Socks5, so you have to look at the type of package you choose. If you use the wrong protocol, it's like taking a bus card to swipe the subway - dead or alive.
Practical case: simulated registration request
Assuming that you want to send registration information to the test site from a dynamic residential IP, the full command looks like this:
curl -x http://user:pass@proxy.ipipgo.net:24000
-H "Content-Type: application/json"
-d '{"username": "test01", "email": "test@demo.com"}'
https://api.demo-site.com/register
Note two key points here:
- The user:pass in the proxy address should be replaced with the authentication information you got from the ipipgo backend.
- The target URL must support HTTPS, not many websites still use HTTP nowadays
Common Rollover Scene Handling
A few common pitfalls encountered by newbies:
Q: What should I do if I return a 407 agent authentication error?
A: Check three places: 1. account password with special characters (URL encoding is recommended) 2. proxy package expires 3. IP whitelisting is configured correctly
Q: JSON data is dead on arrival?
A: First with-vParameters look at the detailed request, focus on checking: 1. request header is not application/json 2. JSON format there is no syntax error 3. is not used in single quotes (have to be changed to double quotes)
Q: The agent suddenly can't connect?
A: Implementation firstcurl --proxy http://代理IP:端口 https://httpbin.org/ipTest connectivity, if timeout suggest changing IP or contact ipipgo technical support
There's something to be said for package selection
Choosing a package at ipipgo home depends on business needs:
| Business Type | Recommended Packages | dominance |
|---|---|---|
| Short-term data collection | Dynamic residential (standard) | Low cost at $7.67/GB |
| Enterprise Crawler | Dynamic Residential (Business) | 9.47/GB, high stability |
| Long-term fixed operations | Static homes | 35$/IP, exclusive use without crowded lines |
Special reminder: if you need to change your IP frequently, choose the dynamic package, and if you want to fix your IP for whitelisting, you must use the static residence. Don't choose the wrong type to save money and end up wasting more time instead.
Debugging Tips
Sharing a few private debugging commands:
View request details (focusing on whether the proxy is in effect)
curl -v --proxy http://代理IP:端口 Destination URL
Test if the JSON format is correct
curl -X POST -H "Content-Type: application/json" -d '@data.json' https://jsonlint.com/
See how long a request takes in real time
curl -w "Proxy response time: %{time_connect} seconds" -o /dev/null -s Target URL
When encountering weird problems, it is recommended to check yourself with these commands first, which can solve common problems with 80%. If you really can't figure it out, ipipgo's tech support is pretty responsive, basically responding within half an hour on weekdays.
Guide to avoiding the pit
A few final bloody lessons:
- Don't bring sensitive information in JSON data, proxy IP is just transit not encryption.
- Add random delays to consecutive requests, don't use fixed intervals
- Important business is recommended to buy a dedicated IP package, shared IP may be linked to the previous person
- Regularly check the egress location of proxy IPs to prevent carriers from secretly switching regions
Mastering these techniques, along with ipipgo's stable proxy, will make sending JSON requests from cURL a piece of cake. If there's anything I didn't make clear, or if you encounter any new problems in actual use, please feel free to tease our technical support team.

