note 29005 modified in function.fsockopen by danbrown
| From: | danbrown@php.net | Date: | Sun, 20 Jul 2008 20:00:48 +0000 |
| Subject: | note 29005 modified in function.fsockopen by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142328@lists.php.net to get a copy of this message | ||
Here is how to connect to the web from behind a proxy server:
<?php
/*************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**************/
?>
--was--
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**************/
http://php.net/manual/en/function.fsockopen.php