Author Topic: Carter Lake Advisory Script Breaks ONLY on my site?!?  (Read 1914 times)

0 Members and 1 Guest are viewing this topic.

Offline anchorageweather

  • Forecaster
  • *****
  • Posts: 445
    • http://eetee.us/station/station.php
Carter Lake Advisory Script Breaks ONLY on my site?!?
« on: March 08, 2008, 07:52:55 AM »
Strange?!?

The advisory script running here:

------------ Test Script removed - its working again --------------------

gets:

Code: [Select]
Warning: file(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /virtual/users/e14319-14509/web/station/advisory.php on line 45

Warning: file(http://www.crh.noaa.gov/showsigwx.php?warnzone=KYZ030&warncounty=KYC111): failed to open stream: Resource temporarily unavailable in /virtual/users/e14319-14509/web/station/advisory.php on line 45

Warning: implode(): Bad arguments. in /virtual/users/e14319-14509/web/station/advisory.php on line 45

However, the link in the "implode" line:

http://www.crh.noaa.gov/showsigwx.php?warnzone=KYZ030&warncounty=KYC111

seems to work fine.

The code seems to be working fine on other weather sites as well (Carter Lake, etc.)

It is the vanilla version at Carter Lake's site:

Code: [Select]
<?php

// Force Defaults for Zone and County
if ( ! isset($_REQUEST['warnzone']) )
        
$_REQUEST['warnzone']="KYZ030";
if ( ! isset(
$_REQUEST['warncounty']) )
        
$_REQUEST['warncounty']="KYC111";
if ( ! isset(
$_REQUEST['warnlocal']) )
        
$_REQUEST['warnlocal']="Anchorage";

//You can pass data to this script with:
// http://www.carterlake.org/testadvisory.php?warnzone=IAZ069&warncounty=IAC155&warnlocal=Carter+Lake
//Where the zone is your zone and the county is your county and location is your location
//using pluses in place of spaces

$warnzone $_REQUEST['warnzone'];
$warncounty $_REQUEST['warncounty'];
$warnlocal $_REQUEST['warnlocal'];

//import NOAA Advisory info
//data can be altered by changing the zone and county numbers
//Target data ends up in $targetwarn and $targettext[0]

$html implode(''file("http://www.crh.noaa.gov/showsigwx.php?warnzone=${warnzone}&warncounty=${warncounty}"));

//Get the advisory headers and put them in an array

preg_match_all('|<h3>(.*)</h3>|'$html$headers);
$warnheaders $headers[1];

//Get the advisory text and put them into an array as well

preg_match_all('|<pre>(.*)</pre>|Uis'$html$headers);
$warntext $headers[1];

//If there is more than one advisory, we need to set its priority

if (count($warnheaders) >= 1) {

$i 0;
$flag 0;

//First, around here tornados are the biggest danger. A warning is critical information.
//Display this one first no matter what!

while ($i count($warnheaders)):
if (preg_match("/Tornado Warning/i"$warnheaders[$i])) {  
$targetwarn $warnheaders[$i];
$targettext $warntext[$i];
$targettext explode("$$",$targettext);
$flag 1;
break;
}
$i++;
endwhile;

//Next if there are none of the above found. Display the first warning message.

if ($flag == 0) {
$i 0;
while ($i count($warnheaders)):
if (preg_match("/Warning/i"$warnheaders[$i])) {  
$targetwarn $warnheaders[$i];
$targettext $warntext[$i];
$targettext explode("$$",$targettext);
$flag 1;
break;
}
$i++;
endwhile;
}

//Next if there are none of the above found. Display the first watch message.

if ($flag == 0) {
$i 0;
while ($i count($warnheaders)):
if (preg_match("/Watch/i"$warnheaders[$i])) {  
$targetwarn $warnheaders[$i];
$targettext $warntext[$i];
$targettext explode("$$",$targettext);
$flag 1;
break;
}
$i++;
endwhile;
}

//Next if there are none of the above found. Display the first advisory message.

if ($flag == 0) {
$i 0;
while ($i count($warnheaders)):
if (preg_match("/Advisory/i"$warnheaders[$i])) {  
$targetwarn $warnheaders[$i];
$targettext $warntext[$i];
$targettext explode("$$",$targettext);
$flag 1;
break;
}
$i++;
endwhile;
}

//Next if there are none of the above found. Display the first statement message.

if ($flag == 0) {
$i 0;
while ($i count($warnheaders)):
if (preg_match("/Statement/i"$warnheaders[$i])) {  
$targetwarn $warnheaders[$i];
$targettext $warntext[$i];
$targettext explode("$$",$targettext);
$flag 1;
break;
}
$i++;
endwhile;
}

//Next if there are none of the above found. Set the advisory to default message.

if ($targetwarn == "Hazardous Weather Outlook") {
$targetwarn "NO CURRENT ADVISORIES";
$targettext[0] = "THERE ARE NO ACTIVE WATCHES, WARNINGS OR ADVISORIES";
} else if ($targetwarn == "No Active Hazardous Weather Conditions Found") {
$targetwarn "NO CURRENT ADVISORIES";
$targettext[0] = "THERE ARE NO ACTIVE WATCHES, WARNINGS OR ADVISORIES";
} else if (empty($targetwarn)) {
$targetwarn "NO CURRENT ADVISORIES";
$targettext[0] = "THERE ARE NO ACTIVE WATCHES, WARNINGS OR ADVISORIES";
} else if ($targetwarn == "Short Term Forecast") {
$targetwarn "NO CURRENT ADVISORIES";
$targettext[0] = "THERE ARE NO ACTIVE WATCHES, WARNINGS OR ADVISORIES";
}

if ($targetwarn <> "NO CURRENT ADVISORIES") {

$warnlist 'ALL CURRENT ADVISORIES:';

for ($i 0$i <= count($warnheaders); $i++) {
     $warnheaderplus preg_replace'| |''+'$warnheaders[$i] );
     $warnlist $warnlist '<br><a href="http://www.crh.noaa.gov/showsigwx.php?warnzone=' $warnzone'&warncounty=' $warncounty '&local_place1=' $warnlocal '&product1=' $warnheaderplus '" target="_new">' $warnheaders[$i] . '</a>';
}
}

}

echo 
"<b>";
echo 
$targetwarn;
echo 
"</b><br><br><pre>";
echo 
$targettext[0];
echo 
$warnlist;
echo 
"</pre>";
?>


I'm stumped?!?!  Does anyone have any ideas?  I'd like to keep using this script if possible,  I've got the text colors, language, etc. tweaked to my liking  :-(
« Last Edit: March 08, 2008, 12:21:24 PM by anchorageweather »
South of the Tracks, Anchorage, KY

Offline anchorageweather

  • Forecaster
  • *****
  • Posts: 445
    • http://eetee.us/station/station.php
Re: Carter Lake Advisory Script Breaks ONLY on my site?!?
« Reply #1 on: March 08, 2008, 09:55:48 AM »
Well, it seems to have fixed itself?!?  I didn't change anything either  :oops:  I swear, sometimes I feel like my site is haunted or something.  Sometimes the whole thing gets frustrating.  I'm thinking I should pick a new hobby.  Maybe rock collecting or something.  ](*,)


P.S.  My webcam is messed up now.  On to the next crisis.  :mad:
South of the Tracks, Anchorage, KY

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6765
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Carter Lake Advisory Script Breaks ONLY on my site?!?
« Reply #2 on: March 08, 2008, 10:11:56 AM »
The problem wasn't with the script, it was with your hoster's webserver.  The first message
Code: [Select]
Warning: file(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /virtual/users/e14319-14509/web/station/advisory.php on line 45showed the webserver temporarily lost the ability to do a DNS lookup for www.crh.noaa.gov

The second message
Code: [Select]
Warning: file(http://www.crh.noaa.gov/showsigwx.php?warnzone=KYZ030&warncounty=KYC111): failed to open stream: Resource temporarily unavailable in /virtual/users/e14319-14509/web/station/advisory.php on line 45 was a direct result of having the DNS problem shown in the first message.

When the DNS issue was resolved, stuff went back to working normally.

So.. nothing you did .. it was your hoster's problem and they got it fixed :)

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline anchorageweather

  • Forecaster
  • *****
  • Posts: 445
    • http://eetee.us/station/station.php
Re: Carter Lake Advisory Script Breaks ONLY on my site?!?
« Reply #3 on: March 08, 2008, 12:20:19 PM »
The problem wasn't with the script, it was with your hoster's webserver.  The first message
Code: [Select]
Warning: file(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /virtual/users/e14319-14509/web/station/advisory.php on line 45showed the webserver temporarily lost the ability to do a DNS lookup for www.crh.noaa.gov

The second message
Code: [Select]
Warning: file(http://www.crh.noaa.gov/showsigwx.php?warnzone=KYZ030&warncounty=KYC111): failed to open stream: Resource temporarily unavailable in /virtual/users/e14319-14509/web/station/advisory.php on line 45 was a direct result of having the DNS problem shown in the first message.

When the DNS issue was resolved, stuff went back to working normally.

So.. nothing you did .. it was your hoster's problem and they got it fixed :)

Best regards,
Ken


Ken, thanks for taking a look and restoring some peace of mind!  I thought I was going crazy.  #-o 
« Last Edit: March 09, 2008, 08:24:41 AM by anchorageweather »
South of the Tracks, Anchorage, KY

 

anything