require_once 'configft.inc';
$fp = fsockopen($MAIN_WEBSERVER_HOST, $MAIN_WEBSERVER_HTTPPORT, $errno, $errstr, 30);
if (!$fp) {
$fp = fsockopen($SECOND_WEBSERVER_HOST, $SECOND_WEBSERVER_HTTPPORT, $errno, $errstr, 30);
if (!$fp) { // echo "Impossible d'ouvrir : $errstr ($errno)
\n";
echo "
Le serveur est momentanément indisponible : merci d'essayer plus tard
"; }
else { hostfound() ; }
}
else { hostfound() ;
echo "Monastir Habib Bourguiba Airport";}
function hostfound()
{
extract($GLOBALS);
stream_set_timeout($fp, 5);
$out = "GET /oacaapp/hvdyn/requetevolsencall2.php\r\n";
$out .= "Connection: Close \r\n\r\n";
fwrite($fp, $out);
while (!feof($fp))
{
echo fgets($fp, 128);
}
fclose($fp);
}
// method 2
//$handle = file_get_contents("http://icareserver/");
//$contents = fread ($handle, filesize ($filename));
//echo $handle ;
?>