usage:
<?
include('proxy.inc.php');
print(proxy_url('http://www.google.com'));
?>
file:proxy.inc.php
<?
function proxy_url($proxy_url)
{
$proxy_name = '10.10.10.117';
$proxy_port = 8088;
$proxy_user = "user"; // username for proxy authentication
$proxy_pass = "password"; // password for proxy authentication added
$proxy_cont = '';
$proxy_fp = fsockopen($proxy_name, $proxy_port);
if (!$proxy_fp) {return false;}
fputs($proxy_fp, "GET $proxy_url HTTP/1.0\r\nHost: $proxy_name\r\n");
fputs($proxy_fp, "Proxy-Authorization: Basic " . base64_encode ("$proxy_user:$proxy_pass") . "\r\n\r\n"); // added
while(!feof($proxy_fp)) {$proxy_cont .= fread($proxy_fp,4096);}
fclose($proxy_fp);
$proxy_cont = substr($proxy_cont, strpos($proxy_cont,"\r\n\r\n")+4);
return $proxy_cont;
}
?>