December 14, 2007

Sherif Gayed 30-Jan-2003 03:00

Here is how to connect to the web from behind a proxy server:

/*************start code**************/

/*your proxy server address*/

$proxy = “192.168.10.1”;

/*your proxy server port*/

$port = 8080;

/*the url you want to connect to*/

$url = “http://www.php.net/”;

$fp = fsockopen($proxy, $port);

fputs($fp, “GET $url HTTP/1.0\r\nHost: $proxy\r\n\r\n”);

while(!feof($fp)){

$line = fgets($fp, 4000);

print($line);

}

fclose($fp);

/*************end code**************/