River/Lake Height Display addon page for WD-AJAX-PHP-USA

Hey Dennis and Chris, I tried the Script on a different server I have, my dondelingerphotography.com site.
It works great on that server. So I need to get with the people at my foresthillweather.com site and hopefully get them to fix it. I thank you guys very much for your help.

Thanks again Scott

I see your flood guage page is up and running…what was the problem???

Hi Chris and Dennis, The best way I can explain what they did is to pass the info they sent me via email.

This is what they sent me.

The problem does not seem to be with our server but with the PHP code
itself.

The PHP code (wxriverpage.php) uses simpleXML to parse the
river-XXX.txt files and breaks out the information in those XML into
different variables that are then used to generate the webpage based
on a bunch of if statements that uses math operations for comparisons.

The problem is that simpleXML returns values that are of type “Object”
and the comparisons utilize the number_format() function and this
function does not seem to know what to do with an “Object” variables.
So even though variables like $ObsStage seemed to have a valid integer
/ float value associated to it, number_format() would return a null or
something else that would make the comparisons invalid / wrong thus
generating the wrong results for the page output.

A simple fix was to convert the simpleXML objects to something that
number_format() likes so I update the code to convert all the
simpleXML objects to strings and the page now renders correctly.

Sample: Before

$ObsStage = $xmlData[“$riverid”]->observed->datum[0]->primary;

After:

$ObsStage = (string)$xmlData[“$riverid”]->observed->datum[0]->primary;

This seems to be a common issue coders run into when trying to use
math operations on variables created from simpleXML.

http://www.php.net/manual/en/book.simplexml.php#95762
http://www.php.net/manual/en/book.simplexml.php#94105

I’m not sure why the unmodified code seems to work on your other host
provider and not on our server but my guess is that our servers are
running different versions of PHP and they changed something between
versions.

What I have is a big band aid on that script within the server to make it work. My server is running the lastest PHP which is PHP 5.3.3 The script worked fine on my go daddy server, but that was PHP 5.2.8 I am still curious if anybody else is running version PHP 5.3.3. with this script.

Dennis I like what you have done with Jim at Juneau County Weather on the clickable map. Let me know if you do get a fix for this, or something you want me to test on my server. I will keep checking for updates. Also what this script does is so good it is well worth it.

Again thank you very much Scott

Version 2.00 - Set-18-2010 - Big changes, Clickable map- Thanks to Jim, also added the ability to put the images at the top or the bottom of the page. Hopefully fixed the script for the newest version of PHP.

Download at beginning of thread.

I would also like to apologize to everyone, I have been writing this between my computer at home and my computer at school. When writing new versions, sometimes improvements are left out that were incorporated in older versions. This version should have all the good stuff listed on the site.

-Dennis

Glad to offer this idea for huge improvement along with code for map.

Lee,

You’re right, your code is what got me thinking about it. The new version now scrapes the code from the AHPS site so that the mouseovers are always current.

Dennis,

I don’t think your changes made it to the download .zip because the most recent dates in there are the 12th.

  • Jim

Jim,

I think your right…doing too many things at the same time.

Now it is uploaded everyone.

Lee,

Thanks for giving us a starting point with the clickable map.

-Dennis

Thanks for the update guys! Works great

Tony 8)

Good day…I replaced the URL with my local clickable image, replaced what was needed in “river-fetch.php” and reuploaded…th emap isn’t displaying…was the URL suppose to be replace elsewhere also??

Has the cron job river-config run yet? I ran mine after I installed everything
and it was a-ok.

Yeah it ran…the map is displaying but its not click-able…

http://www.bucksweather.com/wxriverpage.php

Chris,

Looks like you need to change the permissions on your river-map.txt.

-Dennis

I have them at 664…I’ll check further.

Is the only place to change the url in the river-config.php file??

Got it…had to change permisions to 777 in the river-map file…

Thank you.

Nice script, but I seem to have a few problems I need help with.

I could not get the river-fetch to work at first so I used the “if the curl does not work” code and it stated to work. I was getting a “HTTP 500 Internal Server Error” before changing this code.

I thought everything was working till I tried using one of the detail pages; I’m now getting the “HTTP 500 Internal Server Error” again.

My guess is it’s my Windows 2003 server running IIS that is causing the problem. Anyone know what I can try to fix this?

http://www.weathercat.net/wxriverpage.php

Excellent script! Thank you very much. :smiley:

http://www.harpersferry-weather.com/wxriverpage.php

I’ve been trying to figure how to add the “Weekly Chance of Exceeding Levels” and “Chance of Exceeding Levels During the Entire Period” to the detail page. The NWS does not produce these graphics for all locations.

Example URL’s can be seen below.

http://water.weather.gov/ahps2/rfc/PAWW2.SSTG.prob.weekint.gif
http://water.weather.gov/ahps2/rfc/FDKM2.SSTG.exceed.90day.gif

Is there any chance of adding the exceedance graphics as an option in a future enhancement?

Thanks,

John

Works prefect right out of the box.

http://www.foresthillweather.com/wxriverpageA.php

Thanks again

Scott

Can anyone look at my www.bucksweather.wxriverpage.php page and see what went wrong all of a sudden???

no com org or net

This works
http://www.bucksweather.com/wxriverpage.php

Mark