Portal Home > Knowledgebase > Tutorials > How to use proxies in PHP Code

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:
$url = 'http://checkip.instantproxies.com/';
$proxy = '';  // <-- 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_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
$contents = curl_exec($curl);
return $contents;

Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read

Powered by WHMCompleteSolution

© InstantProxies.com. All Rights Reserved.