<?php
/************************
*
function Purpose: Gets the Remote Web page content of the specified server when the same domain name corresponds to multiple IPs
* Date Created: 2008-12-09
* Created by: Zhang Yi (img.jb51.net)
* Parameter Description:
* $ip The IP address of the server
* The host name of the $host server
* The URL address of the $url server (excluding domain name)
* Return value:
* Access to the Remote Web page content
* False access to Remote Web page failed
************************/
function Httpvisit ($ip, $host, $url)
{
$errstr = ";
$errno =
‘‘;
$fp = Fsockopen ($ip, $errno, $errstr, 90);
if (! $fp)
{
return false;
}
Else
{
$out = "GET {$url} http/1.1\r\n";
$out. = "host:{$host}\r\n";
$out. = "connection:close\r\n\r\n";
Fputs ($fp, $out);
while ($line = Fread ($fp, 4096)) {
$response. =
$line;
}
Fclose ($FP);
Remove header information
$pos =
Strpos ($response, "\r\n\r\n");
$response = substr ($response, $pos + 4);
return $response;
}
}
Call Method:
$server _info1 =
Httpvisit ("72.249.146.213", "img.jb51.net", "/abc.php");
$server _info2 =
Httpvisit ("72.249.146.214", "img.jb51.net", "/abc.php");
$server _info3 =
Httpvisit ("72.249.146.215", "img.jb51.net", "/abc.php");
?>
function Purpose: Gets the Remote Web page content of the specified server when the same domain name corresponds to multiple IPs