How to use proxies in PHP Code

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://checkip.instantproxies.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;
}
 
?>
 
 
 
 
  • 1501 Users Found This Useful
Was this answer helpful?

Related Articles

How to use proxies in Java code

Before using our proxies, ensure that your server IP address is authorized via the proxy control...

How to use proxies in the Firefox Browser

1. Open Firefox and select Tools > Options 2. Under the Advanced > Network, click...

How to use the InstantProxies.com Control Panel

1. Don't know your admin panel login? Find it in the client area2. Sign into the admin panel at...

How to use proxies in the Chrome Browser

1. Open Chrome and navigate to chrome://chrome/settings (or select Tools > Settings) 2....

How to use proxies in Internet Explorer

1. Open Internet Explorer and click Tools > Internet Options 2. Under the Connection tab,...

Powered by WHMCompleteSolution