<?
$defZipCode = "49341";
$IP = getenv("REMOTE_ADDR");
exec("whois -h whois.arin.net $IP",$arZipCode);
if(strstr(substr($arZipCode[2],-5),"-")) {
$zipCode = intval(substr($arZipCode[2],strlen($arZipCode[2]) - 10, 5));
} else {
$zipCode = intval(substr($arZipCode[2],-5));
}
if(strlen($zipCode) < 5) { $zipCode = $defZipCode; }
$url = "http://www.weather.com/weather/us/zips/$zipCode.html";
$string = implode("n", file($url));
$string2 = explode("<!-- obs include -->", $string);
$string3 = explode("<!-- forecast include -->", $string2[1]);
$string5 = explode("<CENTER>", $string3[0]);
$string4 = explode("<!-- end of obs/fcst table -->", $string3[1]);
$currentweather = $string5[0];
$extforecast = $string4[0];
echo $currentweather;
echo $extforecast; ?>
|
|