Author Topic: PHP Script to Display Your Wunderground Historical Data  (Read 31927 times)

0 Members and 1 Guest are viewing this topic.

Offline Russell797

  • Senior Member
  • **
  • Posts: 81
    • Lowell Highlands Weather
Re: PHP Script to Display Your Wunderground Historical Data
« Reply #50 on: April 23, 2009, 11:04:17 PM »
The script returns a single digit "0" for all daily total rainfall regardless of date. The other time frames are working fine. This seems specific to my data which is uploaded  by WeatherLink using the old upload module version #1 produced by Davis for the Monitor II station I still have in operation. Other sites I have tried work fine save for one other I checked. On the WU site my daily rain is presented as expected.

You can see my page here: http://www.lowellhighlandsweather.com/WU_History/index.php

And the WU page: http://www.wunderground.com/weatherstation/WXDailyHistory.asp?ID=KMALOWEL2

As an aside check out the number of "hits" my data gets on the WU page!  :shock:

Is this problem a known issue with the script? Can it be fixed?

Thanks,

Russ



« Last Edit: April 23, 2009, 11:12:14 PM by Russell797 »
Lowell Highlands Current Weather Conditions


Offline jmcmurry

  • Jim McMurry
  • Forecaster
  • *****
  • Posts: 528
  • Davis Vantage Pro 2 Plus Wireless.
    • Juneau County Weather
Re: PHP Script to Display Your Wunderground Historical Data
« Reply #51 on: April 24, 2009, 08:58:25 AM »
Russ,

I just checked my data (some rain today) and it matches perfectly with WU.  When I look at your .csv data which is what the script reads, you have -99.99 in the second to last column (dailyrainin) so that is the problem.  I looked at yesterday, April 23rd.

So obviously WU is receiving your data and displaying it correctly, but for some reason the .csv file they produce isn't correct.  I don't know what that could be, perhaps someone else here has an idea.

- Jim

Forum Search and Google Can be Your Best Friends

Offline LeomaTNWX

  • Senior Contributor
  • ****
  • Posts: 271
    • Leoma, Tn Weather
Re: PHP Script to Display Your Wunderground Historical Data
« Reply #52 on: April 25, 2009, 04:01:27 PM »
I have never used PHP could someone give me some help on how to add this to my site?

Thanks

Offline jmcmurry

  • Jim McMurry
  • Forecaster
  • *****
  • Posts: 528
  • Davis Vantage Pro 2 Plus Wireless.
    • Juneau County Weather
Re: PHP Script to Display Your Wunderground Historical Data
« Reply #53 on: April 26, 2009, 07:23:36 AM »
There are instructions here http://jcweather.us/scripts.php and in the .zip file a file named TestHistory.php that demonstrates how to do it.  The file that you include it in must have a .php extension.

Good Luck.  - Jim

Forum Search and Google Can be Your Best Friends

Offline George Richardson

  • WxElement panel
  • Forecaster
  • *****
  • Posts: 1391
    • Smith Mountain Lake Weather
Re: PHP Script to Display Your Wunderground Historical Data
« Reply #54 on: April 27, 2009, 03:03:50 PM »
Jim,

I've been looking forward to adding your script to my site ever since you offered it but my lack of knowledge of Web Site programming in general and Scripting in particular made me procrastinate for the last year and a half. This morning I just DID IT and it really wasn't too painful.

Thank you again for the effort.

George


Offline spweather

  • Contributor
  • ***
  • Posts: 130
    • Sand Point Weather
Re: PHP Script to Display Your Wunderground Historical Data
« Reply #55 on: April 27, 2009, 03:13:55 PM »
Great script Jim, Thank You.

I am having trouble with the font size that has me at witt's end. The URL is http://www.sandpointweather.com/WU-History.php I tried removing the link to my spweather.css even temporarily deleted the file and it didn't change.

I had the same problem when I first installed Ken's (and Tom's) advforecast2.php on my home page, in fact I'm still not pleased with my attempt to fix it.

Any help will be appreciated,
Thanks, Dennis
http://www.sandpointweather.com
Regards,
Dennis

- Davis Wireless Vantage Pro2 Plus w/24hr FARS
- Davis (Ultra)Sonic Anemometer
- Boltek/MicroLDN TOA Lightening Detection
- Porcupine Labs LR4/Fluke 414D Laser Rangefinder snow depth measuring sensor


Offline jmcmurry

  • Jim McMurry
  • Forecaster
  • *****
  • Posts: 528
  • Davis Vantage Pro 2 Plus Wireless.
    • Juneau County Weather
Re: PHP Script to Display Your Wunderground Historical Data
« Reply #56 on: April 27, 2009, 03:35:33 PM »
Dennis,

I remember when the script first came out, Bashy had the same issue.  Obviously some kind of conflict.  I was never able to figure it out for him, but perhaps he eventually did?

- Jim

Forum Search and Google Can be Your Best Friends

Offline LeomaTNWX

  • Senior Contributor
  • ****
  • Posts: 271
    • Leoma, Tn Weather
Re: PHP Script to Display Your Wunderground Historical Data
« Reply #57 on: April 28, 2009, 08:12:35 AM »
I keep getting these errors. Every time I try and re-do it the error changes lines. I have never used php so I am lost. I have been copy and pasting the WU history file into the HTML section of front page. Is this the correct way to do this or am I making it harder than it really is?


Parse error: syntax error, unexpected T_VARIABLE, expecting ';' in /virtual/users/e16105-17163/web/history.php on line 1084

Offline jmcmurry

  • Jim McMurry
  • Forecaster
  • *****
  • Posts: 528
  • Davis Vantage Pro 2 Plus Wireless.
    • Juneau County Weather
Re: PHP Script to Display Your Wunderground Historical Data
« Reply #58 on: April 28, 2009, 09:06:02 AM »
The error makes it impossible to see any of the code on that page, so we'll have to guess a little bit.  FrontPage sometimes causes problems for folks, so let's try this:

Open your history.php file in notepad and re-do the include using that as the editor.  If that doesn't help, next go through the configuration section of WU-History.php where you've made changes and make sure each of the options that you've changed ends with a semi-colon ... you may have inadvertently over-written one which could throw everything out of sync.  You wouldn't think it would get to line 1084 though .....

- Jim

Forum Search and Google Can be Your Best Friends

Offline LeomaTNWX

  • Senior Contributor
  • ****
  • Posts: 271
    • Leoma, Tn Weather
Re: PHP Script to Display Your Wunderground Historical Data
« Reply #59 on: April 28, 2009, 06:14:30 PM »
I use notepad and re did it all and no change. So I tried again and the error went from line 1086 to line 1088 and all I did was copy and past the same file. Everything looks good in the config area.

Offline jmcmurry

  • Jim McMurry
  • Forecaster
  • *****
  • Posts: 528
  • Davis Vantage Pro 2 Plus Wireless.
    • Juneau County Weather
Re: PHP Script to Display Your Wunderground Historical Data
« Reply #60 on: April 28, 2009, 06:50:25 PM »
Let's try this next.  Download a new .zip file from http://jcweather.us/scripts.php and place all of the contents into a folder on your server.  Then run the TestHistory.php file that's in there.  If it works and you see the data for my station come up, then that's a good copy of the script and we'll go from there.

- Jim

Forum Search and Google Can be Your Best Friends

Offline LeomaTNWX

  • Senior Contributor
  • ****
  • Posts: 271
    • Leoma, Tn Weather
Re: PHP Script to Display Your Wunderground Historical Data
« Reply #61 on: April 28, 2009, 07:34:10 PM »
I am at work now so it will be late tonight before I can do that. Thanks for all the help.

Offline LeomaTNWX

  • Senior Contributor
  • ****
  • Posts: 271
    • Leoma, Tn Weather
Re: PHP Script to Display Your Wunderground Historical Data
« Reply #62 on: April 29, 2009, 03:26:14 AM »
I got it working. Thanks for the help.

Offline jmcmurry

  • Jim McMurry
  • Forecaster
  • *****
  • Posts: 528
  • Davis Vantage Pro 2 Plus Wireless.
    • Juneau County Weather
Re: PHP Script to Display Your Wunderground Historical Data
« Reply #63 on: April 29, 2009, 07:04:28 AM »
Great News!  Did you figure out what the problem was?

- Jim

Forum Search and Google Can be Your Best Friends

Offline LeomaTNWX

  • Senior Contributor
  • ****
  • Posts: 271
    • Leoma, Tn Weather
Re: PHP Script to Display Your Wunderground Historical Data
« Reply #64 on: April 29, 2009, 01:49:57 PM »
I downloaded a new copy of the zip file and then used notepad to edit it. Front page was messing it up. Again thanks for the help.

Offline Russell797

  • Senior Member
  • **
  • Posts: 81
    • Lowell Highlands Weather
Re: PHP Script to Display Your Wunderground Historical Data
« Reply #65 on: May 18, 2009, 08:57:51 AM »
THIS IS SERIOUS:

My WU History page generated by this script has been attacked by a robot "spider". I was checking the stats on my hosting server and noticed my bandwidth usage for the month had risen to over 3.5 gigabytes in just over half a month. My typical usage is less than 1/2 gigabyte per month.

Looking deeper into the current usage I found this "bot" accessing my WU page every 4 seconds around the clock!

    Http Code: 200     Date: May 18 07:20:39     Http Version: HTTP/1.1     Size in Bytes: 4523
   Referer:
   Agent: Mozilla/5.0 (compatible; YodaoBot/1.0; http://www.youdao.com/help/webmaster/spider/;
   
       /WU_History/index.php?ID=KMALOWEL2&day=22&mode=4&month=8&units=B&year=1989

------------------------

I blocked the IP address of this "robot" which temporarily halted the activity, but this morning I noticed it was back at work using a new IP address.

Unfortunately I will be forced to remove the script from my site.

Use this as an alert to check if this is happening to you. I have 25 gigs of server bandwidth/month but can not allow this to continue, the gigs add up fast at the rate they are using.
« Last Edit: May 18, 2009, 09:14:07 AM by Russell797 »
Lowell Highlands Current Weather Conditions


Offline Axelvold

  • Forecaster
  • *****
  • Posts: 1704
    • Axelvold's weather and photo
Re: PHP Script to Display Your Wunderground Historical Data
« Reply #66 on: May 18, 2009, 09:53:31 AM »
THIS IS SERIOUS:

My WU History page generated by this script has been attacked by a robot "spider". I was checking the stats on my hosting server and noticed my bandwidth usage for the month had risen to over 3.5 gigabytes in just over half a month. My typical usage is less than 1/2 gigabyte per month.

Looking deeper into the current usage I found this "bot" accessing my WU page every 4 seconds around the clock!

    Http Code: 200     Date: May 18 07:20:39     Http Version: HTTP/1.1     Size in Bytes: 4523
   Referer:
   Agent: Mozilla/5.0 (compatible; YodaoBot/1.0; http://www.youdao.com/help/webmaster/spider/;
   
       /WU_History/index.php?ID=KMALOWEL2&day=22&mode=4&month=8&units=B&year=1989

------------------------

I blocked the IP address of this "robot" which temporarily halted the activity, but this morning I noticed it was back at work using a new IP address.

Unfortunately I will be forced to remove the script from my site.

Use this as an alert to check if this is happening to you. I have 25 gigs of server bandwidth/month but can not allow this to continue, the gigs add up fast at the rate they are using.

Do you have the robots.txt file in your root?
Lars Magnusson
Axelvold / Sweden
55° 57' 41" N / 13° 6' 1" E
WX Station: Davis Vantage Pro2 Plus

Offline Russell797

  • Senior Member
  • **
  • Posts: 81
    • Lowell Highlands Weather
Re: PHP Script to Display Your Wunderground Historical Data
« Reply #67 on: May 18, 2009, 11:16:01 PM »
Axelvold,

No robots.txt file in my server's root directory. The robot is still pounding away in an attempt to access my now non-existent WU_History file. There are actually 2 apparently independent robots looking to download the page. I wonder if the Weather Underground is behind this outrageous affront to my bandwidth allotment in a reciprocal action in retaliation to my pulling down data from their site? Am I the only one experiencing this? :mad:
« Last Edit: May 19, 2009, 09:49:07 AM by Russell797 »
Lowell Highlands Current Weather Conditions


Offline Axelvold

  • Forecaster
  • *****
  • Posts: 1704
    • Axelvold's weather and photo
Re: PHP Script to Display Your Wunderground Historical Data
« Reply #68 on: May 19, 2009, 01:15:40 AM »
Make a robots.txt and write the following in it

User-agent: *
Disallow: /WU_History/
Lars Magnusson
Axelvold / Sweden
55° 57' 41" N / 13° 6' 1" E
WX Station: Davis Vantage Pro2 Plus

Offline jmcmurry

  • Jim McMurry
  • Forecaster
  • *****
  • Posts: 528
  • Davis Vantage Pro 2 Plus Wireless.
    • Juneau County Weather
Re: PHP Script to Display Your Wunderground Historical Data
« Reply #69 on: May 19, 2009, 07:10:08 AM »
Yes, that will happen with any script that calls itself with different parameters such as this one does.  I will have to add that to the documentation.  Thanks Axelvold!

- Jim

Forum Search and Google Can be Your Best Friends

Offline Axelvold

  • Forecaster
  • *****
  • Posts: 1704
    • Axelvold's weather and photo
Re: PHP Script to Display Your Wunderground Historical Data
« Reply #70 on: May 19, 2009, 07:20:33 AM »
The best to do is to enter all the folders that the robots dont should have access to.

And if you have some files in the root that you want to hide from the robot, just write the file name in the files as well.

User-agent: *
Disallow: /WU_History/
Disallow: /filename.php




Lars Magnusson
Axelvold / Sweden
55° 57' 41" N / 13° 6' 1" E
WX Station: Davis Vantage Pro2 Plus

Offline Russell797

  • Senior Member
  • **
  • Posts: 81
    • Lowell Highlands Weather
Re: PHP Script to Display Your Wunderground Historical Data
« Reply #71 on: May 19, 2009, 08:48:31 AM »
I uploaded the robot.txt file to the server root, copied the WU_History files into their folder and check the results with hopeful anticipation, but this is what I observed  :???:

I tried:

User-agent: *
Disallow: /WU_History/

and then:

User-agent: *
Disallow: /WU_History/index.php


Neither stopped the onslaught.


    
   

    * 

   
/WU_History/index.php?ID=KMALOWEL2&day=23&mode=4&month=1&units=M&year=1990
   Http Code: 200    Date: May 19 07:31:44    Http Version: HTTP/1.1    Size in Bytes: 4510
   Referer:
   Agent: Mozilla/5.0 (compatible; YodaoBot/1.0; http://www.youdao.com/help/webmaster/spider/; )   
    *     
/WU_History/index.php?ID=KMALOWEL2&day=27&mode=4&month=11&units=B&year=2026
   Http Code: 200    Date: May 19 07:31:48    Http Version: HTTP/1.1    Size in Bytes: 4542
   Referer:
   Agent: Mozilla/5.0 (compatible; YodaoBot/1.0; http://www.youdao.com/help/webmaster/spider/; )   
    *     
/WU_History/index.php?ID=KMALOWEL2&day=31&mode=5&month=7&units&units=M&year=2024
   Http Code: 200    Date: May 19 07:31:52    Http Version: HTTP/1.1    Size in Bytes: 4608
   Referer:
   Agent: Mozilla/5.0 (compatible; YodaoBot/1.0; http://www.youdao.com/help/webmaster/spider/; )   
    *     
/WU_History/index.php?ID=KMALOWEL2&day=9&mode=5&month=12&units=B&year=1989
   Http Code: 200    Date: May 19 07:31:56    Http Version: HTTP/1.1    Size in Bytes: 90405
   Referer:
   Agent: Mozilla/5.0 (compatible; YodaoBot/1.0; http://www.youdao.com/help/webmaster/spider/; )
   
   
Lowell Highlands Current Weather Conditions


Offline Axelvold

  • Forecaster
  • *****
  • Posts: 1704
    • Axelvold's weather and photo
Re: PHP Script to Display Your Wunderground Historical Data
« Reply #72 on: May 19, 2009, 08:57:39 AM »
check the name on the file, it should be robots.txt

And see to that it is placed in the www root not the server root that i did write in a earlier post, sorry.

If this dont work, try to black list the IP in the server configuration file
Lars Magnusson
Axelvold / Sweden
55° 57' 41" N / 13° 6' 1" E
WX Station: Davis Vantage Pro2 Plus

Offline Russell797

  • Senior Member
  • **
  • Posts: 81
    • Lowell Highlands Weather
Re: PHP Script to Display Your Wunderground Historical Data
« Reply #73 on: May 19, 2009, 09:38:05 AM »
Ok, the big bad guy has stopped downloading. The second one continued, but seems to have a static IP address so I bocked it. (66.249.71.48)

    *     
/WU_History/index.php?ID=KMALOWEL2&month=7-&day=4&year=2008&units=B&mode=2
   Http Code: 404    Date: May 19 08:40:36    Http Version: HTTP/1.1    Size in Bytes: -
   Referer: -
   Agent: Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)

-------------------

The robots.txt file has been successfully read by:

    * 

   
/robots.txt
   Http Code: 200    Date: May 19 08:28:04    Http Version: HTTP/1.1    Size in Bytes: 56
   Referer: -
   Agent: msnbot-media/1.1 (+http://search.msn.com/msnbot.htm)


---------------------

It seems by looking about the net that the robots.txt file is a request to cease robot activity, but some rogue robots can refuse to comply.

http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=40360
« Last Edit: May 19, 2009, 08:02:30 PM by Russell797 »
Lowell Highlands Current Weather Conditions


Offline xmas111

  • Senior Member
  • **
  • Posts: 65
    • http://www.johnsweather.com
Re: PHP Script to Display Your Wunderground Historical Data
« Reply #74 on: April 15, 2011, 06:26:43 PM »
I know this thread is old but I just installed the Wu-History.php and have a quick question.

It's seems to be working fine except it won't show the sky condition.

I have the "sky conditions" turned on in the script, (set to false so it doesn't hide the sky conditions.

On my wunderground page the sky conditions show but not on my page with the script.

here's my wunderground page: http://www.wunderground.com/weatherstation/WXDailyHistory.asp?ID=KMAROCKL1
and here's my page with the script: http://johnsweather.com/wunder/wunder.php

anyone have any idea what I may have done wrong setting up the script?

Thanks,
John

 

anything