Ken True of Saratoga Weather

I would just like to publicly thank Ken True of Saratoga Weather for his forecast scripts as over the last few weeks WuUnderground have changed their site agin and again and Ken without payment has re written his script and made is available to all of us for free where would we be without people like him, Thank you Ken.

If you want to check to see if your up to date the current ver on this date is WU-forecast.php V1.22(ML)

Bogget

Thank you for the kind words, Bogget! I’m glad I can help the weather enthusiasts with scripting for their weather websites.

Fortunately, the source websites are usually slow to change, so updates to scripts are not often needed. WeatherUnderground has been an exception in this regard with one giant change, then a series of small (but significant) changes the last few weeks. I do hope their website tuning will be over soon.

Best regards,
Ken

Hi Ken i see they are at it again 2/feb 2012 no forcast page i assume they have change dthe site again, do you have an update for it please.

Bogget
www.realweather.net

Hmmm…

Something is afoot with WU. The contents of the page requested returns:

HTTP/1.1 301 Moved Permanently
Date: Thu, 02 Feb 2012 18:52:11 GMT
Server: Apache/1.3.33 (Unix) PHP/4.4.0
Cache-control: no-cache, no-cache="Set-Cookie", private
Expires: Fri, 01 Jan 1999 00:00:00 GMT
Pragma: no-cache
Location: http://english.wunderground.com/block.asp
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html

48 
Redirect page


There is nothing to see here, please move along...
0

I’ll have to investigate further…

Ken,

That’s the same thing we had with the WU-History script in another thread and that just started working again for us.

  • Jim

It’s some kind of auto-block script they’ve engaged. You say the WU-history script is working ok now? Maybe they just haven’t tweaked the new scripting to re-allow our access. Still investigating …

I’ve placed a phone message to John Celenza at WeatherUnderground about the issue. I’ll let you know when I hear from him.

Arrrg… bad news. Our WU-forecast.php script will not work in the future. I need to rewrite the script to use their JSON API instead.
Expect to have no WU-forecasts on your sites for several days as I work through generating the equivalent function using their API.

Best regards,
Ken

Oh boy what is wrong with them, OK they may want to update the site often that is up to them but they rely on our weather data in the large part, so why cant they leave a hidden page just as it is for us to get data from for our forcast page, i have seen many replys from them saying they are not trying to stop us getting our data yet here we are again, well as i said at the top thank god for Ken.

Bogget

Current wugraphs-scripts should also be removed or at least hidden from public immedately as they are able to kill the webservers.
Tested here by trying to load 3 graphs (what never appeared) on a site living on same server as my site do and the dual-core webserver got almost killed (loads rised above 6), because the scripts never end. Only way to get ride of them was to restart whole webserver.

Status update:

I talked via email with John Celenza of WeatherUnderground and the issue with the WU-forecast.php script was caused by an IP block by WunderGround on my server’s IP address. They have kindly removed the block, and the script works again.

I did do an update to WU-forecast.php V1.28 tonight to add the ability to follow the 301 redirect to their block.asp page, and cache the contents in the cache file. If it happens that you find no forecast, even after doing a ?force=1 to force a cache refresh, then check the contents of your cache file (do a view source on the page to find the name/location of the file), and in the file will be the text of the block page … you can use the IP address there to contact WU to ask the block be removed.

I also changed the request to include a User-agent: PHP,WU-forecast.php,saratoga-weather.org so they can identify that the request was made by the WU-forecast.php script (and that they should contact me for questions).

Sorry for the alarm … in short:

  1. WU was blocking some IPs for excessive traffic (I think)
  2. The script couldn’t get past the block, so stopped offering you a forecast.
  3. the updated script V1.28 has diagnostics to help you put a request to WU to unblock if it happens to you

I am working (and about 80% finished) with a WU API JSON script and will release it later, but the WU-forecast.php can live on to serve :slight_smile:

Best regards,
Ken

Hmm? i still can not get a forecast i have cleared cash and tried another computer that has never had my site on it still no forecast, am i missing something?

Lol…you say if it doesnt work do a view source and get the location??? OK if your a programmer maybe but what am i looking at??? i have no idea? :?

Bogget
www.realweather.net

Hi Bogget,

There are two issues I found by doing a view-source on http://www.realweather.net/wxforecast.php?force=1

First, the script you’re running is not the updated one (V1.28) so it wouldn’t help diagnose the block.
Second, your cache file ./cache/WU-forecast-en.txt is not writable, so even if the script were updated, we’d not be able to read the cache file to see what address needs to be unblocked.

I suggest you update the script, and make the ./cache/ directory writable, the run the query again for further diagnostics.

Best regards,
Ken

Hi Ken, OK i will update now i assume this is the page we are talking about so i need a template from your site, and where is this cash and how do i make it writeable and why has it stopped being writable?

Bogget

Ok updated now, i found a folder on both my back up of the website and on the website called cache and nothing in either? foler is not in anyway restricted as far as i know, and wc-forcast.txt is blank but properties say its writable i dont have a WU-forecast-en.txt and never have as far as i know?

Just created a WU-forecast-en.txt and uploaded it still not working?

i do wish i knew more about programming?

Bogget
www.realweather.net

Hi Bogget,

The page shows the correct version of the script, but the ./cache/ is not writable by PHP

You might try changing permissions on the ./cache/ directory itself to 777 to make it writable.

Is your WU-forecast-en.txt in a cache directory on the website, or is it in the root like mine is…?

I’ve just been updating this, and mine was blocked, so I’ve contacted WU support.

I have discovered another problem though… since updating my WU-Forecast.php file i get:

“Warning: Division by zero in /virtual/users/e17230-18941/web/WU-forecast.php on line 746” at the top of the home and forecast webpages…??

Daryll.

Hi Daryll,

Looking at your wxforecast.php?force=1 page shows

and your ./WU-forecast-0-en.txt contents shows

HTTP/1.1 200 OK
Date: Sat, 04 Feb 2012 19:27:14 GMT
Server: Apache/1.3.33 (Unix) PHP/4.4.0
Cache-control: no-cache, must-revalidate, no-cache=“Set-Cookie”, private
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Pragma: no-cache
X-CreationTime: 0.024
Set-Cookie: ASC=1328383634:1; path=/; expires=Fri, 01-Jan-2020 00:00:00 GMT; domain=.wunderground.com
Set-Cookie: DT=1328383634:27320:365-t1; path=/; expires=Fri, 01-Jan-2020 00:00:00 GMT; domain=.wunderground.com
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8

106
Request Blocked

Your request to Wunderground.com has been blocked. To get this block removed, please contact wunderground.com:

Your IP is 74.52.111.11, USER_AGENT PHP,WU-forecast.php,saratoga-weather.org

Email: [email protected]

0

So send along a note to [email protected] asking that 74.52.111.11 IP address be unblocked.

Best regards,
Ken

Hi Ken, and thanks for your speedy responses…

As I mentioned, I’ve contacted WU support and asked them to unblock that IP… (i copied and pasted the last few lines from the cache file into the email)

The thing that concerned me was the error message…?? or is this just a consequence of the IP being blocked…?

Daryll

The Warning: error message was just due to the script not finding a valid cache of the WU forecast page … it will go away when the block is removed.

Best regards,
Ken