<?php
$url1 = "http://w.skyfox.org/";//主网站
$url2 = "http://www.skyfox.org/"; //备用网站
$array = get_headers($url,1);
if(preg_match('/200/',$array[0])){ //200为正常代码,经常见到的还有404,400,500等
echo "<script language='javascript' type='text/javascript'>";
echo "window.location.href='$url1'";
echo "</script>";
// echo "<pre/>";
// print_r($array);
}else{
echo "<script language='javascript' type='text/javascript'>";
echo "window.location.href='$url2'";
echo "</script>";
}
?>