How to use proxies in PHP Code

Created by CAPTCHA Proxies, Modified on Tue, 12 Sep, 2023 at 4:30 PM by CAPTCHA Proxies

Before using our proxies, ensure that your server IP address is authorized via the proxy control panel.
 
Sample code for using our proxies in PHP Code:
 
<?php
 
$url = 'http://captchaproxies.com';
$proxy = '1.1.1.1:8800';  // <-- set your proxy
$content = requestUrl($url, $proxy);
print $content;
print 'Done requesting '.$url.'...';
 
function requestUrl($url, $proxy = NULL) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
if ($proxy != NULL) {
curl_setopt($curl, CURLOPT_PROXY, $proxy);
}
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
$contents = curl_exec($curl);
curl_close($curl);
return $contents;
}
 
?>

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article