WXforum.net

Web Weather => Weather Website PHP/AJAX scripting => Topic started by: Bunty on March 21, 2018, 12:14:18 PM

Title: River Levels Page No Longer Loading
Post by: Bunty on March 21, 2018, 12:14:18 PM
Are other people having a problem with the river page not loading?  I get a error that says:
[20-Mar-2018 22:28:13 America/Chicago] PHP Fatal error:  Call to a member function attributes() on null in /home/stillwat/public_html/wx/wxriverdetail.php on line 95
Title: Re: River Levels Page No Longer Loading
Post by: rrrick8 on March 21, 2018, 03:58:25 PM
Yes, my details are not loading either.
Title: Re: River Levels Page No Longer Loading
Post by: Otis on March 21, 2018, 05:28:57 PM
Mine is not working either, it was working just about 3 days ago.
Title: Re: River Levels Page No Longer Loading
Post by: Forever on March 21, 2018, 06:08:33 PM
It looks like the script is no longer downloading the needed data, all of the txt files are empty.
Title: Re: River Levels Page No Longer Loading
Post by: rrrick8 on March 21, 2018, 06:16:10 PM
I notice that it is working on Dennis's (the creator's) website... http://eastmasonvilleweather.com/wxriverpage.php (http://eastmasonvilleweather.com/wxriverpage.php).
I'll send him a notice and link to this discussion to see if he knows that it has stopped for us.
Title: Re: River Levels Page No Longer Loading
Post by: EastMasonvilleWX on March 21, 2018, 07:17:58 PM
Hey Guys,

Pretty easy fix, need to make the data location a https. Execute as below. It will be found in the river-fetch.php in the River folder.

Currently:
Code: [Select]
$ch = curl_init("https://water.weather.gov/ahps2/hydrograph_to_xml.php?gage=$riverid&output=xml");
Updated:
Code: [Select]
$ch = curl_init("http://water.weather.gov/ahps2/hydrograph_to_xml.php?gage=$riverid&output=xml");
I have attached an updated file. Change the extension to .php.

Should fix your issues, I will work on updating my site this weekend.

Thanks,
-Dennis
Title: Re: River Levels Page No Longer Loading
Post by: rrrick8 on March 21, 2018, 07:25:32 PM
Figures.  :oops:
I changed the http to https in about 6-7 different places of the script but forgot about the fetch.php
Should have figured that out with it being the Cron job for the script.
 ](*,) ](*,) ](*,)

Thanks Dennis.
Title: Re: River Levels Page No Longer Loading
Post by: Otis on March 22, 2018, 06:48:18 AM
I did the same thing and missed the same one  ](*,)

Thanks for the fix Dennis.


Figures.  :oops:
I changed the http to https in about 6-7 different places of the script but forgot about the fetch.php
Should have figured that out with it being the Cron job for the script.
 ](*,) ](*,) ](*,)

Thanks Dennis.
Title: Re: River Levels Page No Longer Loading
Post by: vomaretired on March 22, 2018, 03:15:31 PM
Mine stopped working recently too but found by using the code on line 39:

//    if the curl does not work
   $html = implode(" ", file("http://water.weather.gov/ahps2/hydrograph_to_xml.php?gage=$riverid&output=xml"));
   $fp = fopen("river-$riverid.txt", "w");
   if ($fp) {
   $write = fputs($fp, $html);
   fclose($fp);
   }
}
Instead of using fetch I started using the code above and it worked again. Never thought of the https being the problem but knew someone would come up with a fix. Thanks for the update Dennis.
Title: Re: River Levels Page No Longer Loading
Post by: tmabell on March 22, 2018, 03:38:20 PM
Thanks Dennis.  Out of curiosity is there a chance that you might have the entire script available?  I am running a rather old version and would like to get current.
Title: Re: River Levels Page No Longer Loading
Post by: rrrick8 on March 22, 2018, 03:49:58 PM
Thanks Dennis.  Out of curiosity is there a chance that you might have the entire script available?  I am running a rather old version and would like to get current.
I'm mobile and don't have it with me but I believe it's available on his website. Just follow the link through his signature and it's in the menu on the far right tab I believe

Sent from my SAMSUNG-SM-G928A using Tapatalk

Title: Re: River Levels Page No Longer Loading
Post by: tmabell on March 22, 2018, 03:55:54 PM
Got it, thanks!
Title: Re: River Levels Page No Longer Loading
Post by: tmabell on March 22, 2018, 04:38:21 PM
Can anyone who is using PHP version 7.2 confirm that this script is working for them?
Title: Re: River Levels Page No Longer Loading
Post by: tbrasel on March 24, 2018, 09:31:09 AM
Can anyone who is using PHP version 7.2 confirm that this script is working for them?

Yes it works, if I am referencing the same script.

Although, after I updated from PHP 7.1, to 7.2, A Warning: simplexml_load_file(): appeared. This warning was quickly resolved however.
Title: Re: River Levels Page No Longer Loading
Post by: tmabell on March 24, 2018, 09:57:37 AM
I see that on your page as of just now.  I'll bet that if you look at your server's error logs you'll see dozens upon dozens of PHP warnings and notices.  With a little help from a friend, I was able to circumvent enough of those to get it to work and at that point I gave up and turned error reporting off.
Title: Re: River Levels Page No Longer Loading
Post by: tbrasel on March 24, 2018, 10:23:41 AM
Nothing is showing in my error log, currently.
Title: Re: River Levels Page No Longer Loading
Post by: jgillett on March 26, 2018, 09:34:12 PM
Missing something on my http://tiggrweather.net/wxriverpage.php. Map and headers show but not the table listing. Cron appears to have run once (sorta) but possibly not completely. Server returned...
Code: [Select]
0 Gauges Near Flood Stage</br>0 Gauges with Minor Flooding</br>0 Gauges with Moderate Flooding</br>0 Gauges with Major Flooding</br>0 Gauges in Action or above</br>Last Update: Monday March 26th, 2018 12:16 PM MST</br>Next Update: Monday March 26th, 2018 04:13 PM MST...at 1216 today but then nothing else.

Thanks.
Title: Re: River Levels Page No Longer Loading
Post by: rrrick8 on March 26, 2018, 09:37:40 PM
Missing something on my http://tiggrweather.net/wxriverpage.php. Map and headers show but not the table listing. Cron appears to have run once (sorta) but possibly not completely. Server returned...
Code: [Select]
0 Gauges Near Flood Stage</br>0 Gauges with Minor Flooding</br>0 Gauges with Moderate Flooding</br>0 Gauges with Major Flooding</br>0 Gauges in Action or above</br>Last Update: Monday March 26th, 2018 12:16 PM MST</br>Next Update: Monday March 26th, 2018 04:13 PM MST...at 1216 today but then nothing else.

Thanks.

Did you apply the fix Dennis posted above?
Title: Re: River Levels Page No Longer Loading
Post by: jgillett on March 26, 2018, 09:39:41 PM
Did you apply the fix Dennis posted above?
Yes. Actually downloaded the script he posted.

Thanks.
Title: Re: River Levels Page No Longer Loading
Post by: jgillett on March 26, 2018, 11:31:49 PM
Got it. Mine needed $riverstodisable= "0" rather than the default (apparently) 1 setting. Now working.
Title: Re: River Levels Page No Longer Loading
Post by: jgillett on March 27, 2018, 09:32:09 PM
I gave up. Cron ran once Mon night but no more since then.

Thanks anyway, guys.
Title: Re: River Levels Page No Longer Loading
Post by: Breezy on March 27, 2018, 11:57:58 PM
I updated "river-fetch.php"  from Dennis's new file but no go. What else has to be edited?

Thanks.
Title: Re: River Levels Page No Longer Loading
Post by: Bunty on March 28, 2018, 01:32:28 PM
Mine is working but lacks the rising.gif.
https://stillwaterweather.com/wx/wxriverpage.php (https://stillwaterweather.com/wx/wxriverpage.php)
Title: Re: River Levels Page No Longer Loading
Post by: tmabell on March 28, 2018, 01:43:48 PM
In my River-Config.php I have this:

Code: [Select]
$arrowfolder = "/ajax-images"; // The folder where the arrows are located.
In /ajax-images  I have three images... rising.gif, falling.gif and steady.gif.  These are the arrows.

Check your settings and for the presence of those three images.
Title: Re: River Levels Page No Longer Loading
Post by: vomaretired on March 28, 2018, 03:23:18 PM
If Cron isn't working create a download of the river-fetch.php every few hours with your Weather Display software. I have mine to download the file every four hours by using the 'HTTP Download' portion of FTP/Internet Setup and is working fine.
Title: Re: River Levels Page No Longer Loading
Post by: Breezy on March 28, 2018, 03:28:29 PM
Got it running! Thanks Dennis for the update ...   \:D/