Current NWS Text - Southern Worcester County |
Watches, Warnings & Advisories |
1) {
$NOAAwatch[1] = 'Southern' . $NOAAwatch[1];
} else {
$NOAAwatch[1] = 'There is currently no Watches or Warnings for our area';
}
function fetchUrlWithoutHanging($url)
{
// Set maximum number of seconds (can have floating-point) to wait for feed before displaying page without feed
$numberOfSeconds=4;
// Suppress error reporting so Web site visitors are unaware if the feed fails
error_reporting(0);
// Extract resource path and domain from URL ready for fsockopen
$url = str_replace("http://","",$url);
$urlComponents = explode("/",$url);
$domain = $urlComponents[0];
$resourcePath = str_replace($domain,"",$url);
// Establish a connection
$socketConnection = fsockopen($domain, 80, $errno, $errstr, $numberOfSeconds);
if (!$socketConnection)
{
// You may wish to remove the following debugging line on a live Web site
// print("");
} // end if
else {
$xml = '';
fputs($socketConnection, "GET $resourcePath HTTP/1.0\r\nHost: $domain\r\n\r\n");
// Loop until end of file
while (!feof($socketConnection))
{
$xml .= fgets($socketConnection, 128);
} // end while
fclose ($socketConnection);
} // end else
return($xml);
} // end function
?>
echo $NOAAwatch[1]; ?>
|
Special Weather Statement |
|
Short Term Forecast |
|
Hazardous Outlook |
|
|