
Don't let the IP drag your feet! Hands-on PHP cURL hanging proxy
The old iron engaged in data collection surely understand that the target site blocked IP faster than the book. Last week an e-commerce friends and I touted, they use PHP to climb the price of competitors, the results of half an hour was blocked more than 20 IP. this time on the need for proxy IP to save the day, today we take the most commonly used cURL to open the knife, to teach you how to silky-smooth IP switch.
Don't step in the puddle with cURL Basic Configuration
Let's start with an example of how easy it is for a novice to roll over:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "Destination URL");
curl_exec($ch);
Writing this way is equivalent to running naked on the Internet, the target site can find out your real IP in minutes. remember the three key parameters:CURLOPT_PROXY(Proxy address),CURLOPT_PROXYTYPE(protocol type),CURLOPT_TIMEOUT(Timeout time).
Proxy code example
Take ipipgo's Socks5 proxy as an example (be careful to replace your own account password):
$proxy = 'socks5://user:pass@proxy.ipipgo.net:端口';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://目标网站");
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
curl_setopt($ch, CURLOPT_TIMEOUT, 15); curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
if(curl_errno($ch)){
echo 'Rollover: '.curl_error($ch); }
}
curl_close($ch);
Key Reminder: If you encounter problems with SSL certificates, theNever use CURLOPT_SSL_VERIFYPEER=>falseThe correct posture for this dangerous operation is to have ipipgo customer service match you with an exclusive certificate.
Parameter Tuning Tips
Adjust these parameters according to the business scenario:
| take | Recommended Configurations |
|---|---|
| high frequency acquisition | Timeout 8-10 seconds + automatic proxy switching |
| Large file downloads | Timeout 30 seconds + Exclusive IP |
| Analog Login | Enable COOKIE storage + static residential IPs |
Frequently Asked Questions QA
Q: Proxy settings are successful but I can't connect?
A: First check whether the port is open, use telnet to test connectivity. ipipgo users can go to the background to generate a temporary test IP.
Q: How do I choose a package for Enterprise Capture?
A: High-frequency access with dynamic residential (enterprise version), the need to fix the identity of the selected static residential. Don't try to be cheap and use shared IPs, they are sealed up in batches.
Where to find a reliable agent?
Recommended by my own brotheripipgo, their TK dedicated line measured latency can be pressed to within 200ms. Focus on three advantages:
- Dynamic IP pool updated daily 20%IP resources, not afraid of being blocked
- The client comes with intelligent routing, automatically selecting the fastest node
- Tech support responds in seconds, last time I raised a work order at 3am, someone actually responded!
Package prices are clearly marked (2024.08 latest price):
Dynamic Residential (Standard) from $7.67/GB
Dynamic Residential (Enterprise) from $9.47/GB
Static Residential $35/unit/month
Finally said a cold knowledge: with proxy collection remember to control the frequency of requests, even the best IP can not hold hundreds of times per second bombardment. Personally, I suggest that you take the free test resources to practice, and then get familiar with the production environment.

