#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    Land of Oz (East Tennessee)
    Posts
    16
    Rep Power
    0

    Need help with table update


    I am in the process of re-doing my web site and would like to automatically refresh and incorporate a specific weather table from the NWS web site (Current Conditions) for my area. National Weather Service I am not by any means a HTML master I know just enough to get through with FrontPage 2002, Notepad and some VERY basic HTML and alot of cutting and pasting. How would I be able make my website (using CSS template) go refresh every 50 minutes or so to the NWS weather page and update just the current weather conditions information within that table on the NWS website and then input it automatically onto my website?

    I have searched this site ( for hours) and the web for the last couple of days and can not find anything to help (probably asking the wrong type of question)

    If someone knows how to do this with and wouldn't mind showing me the code whether it is HTML or whatever that will work within Frontpage 2002 I would appreciate it

    Thaniks in advance!!!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    USA
    Posts
    830
    Rep Power
    14
    If you have a scripting engine like PHP or ColdFusion on your web server you could probably do it without too too much trouble.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    Land of Oz (East Tennessee)
    Posts
    16
    Rep Power
    0
    I have a PHP bb on my server space, but I am truely unfamiliar with PHP. How would I do this???
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    USA
    Posts
    830
    Rep Power
    14
    Post the URL of the page and describe specifically what part of it you want to pick up. I could tell you how to do it, but I don't know if it's legal or proper.
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    Land of Oz (East Tennessee)
    Posts
    16
    Rep Power
    0
    According to the NWS using their information is NOT copyrighted or restricted I ahve already looked at the policies. The remote URL is herehere My site is here BATC The only information I would like to "grab or fetch" at least every thirty minutes is the CURRENT CONDITIONS area of the page. Nothing else. Please let me know if this is possible...Thanks in advance...

    Below is the HTML (I think that's all of it) that I want to grab or fetch also:

    <td width="326"><img src="/weather/images/fcicons/currentconds.jpg" width="326" height="20" border="0" alt="Current local weather"><br><br><table cellspacing="0" cellpadding="0" border="0" width="100%">
    <tr align="center">
    <td><span class="blue1">Knoxville, McGhee Tyson Airport</span><br>
    Last Update on Nov 14, 12:53 pm EST<br><br></td>
    </tr>
    <tr>
    <td colspan="2"><table cellspacing="0" cellpadding="0" border="0">
    <tr>
    <td class="big" width="120" align="center">Mostly Cloudy<br><br>46&deg;F<br>(8&deg;C)</td>
    <td rowspan="2" width="200"><table cellspacing="0" cellpadding="2" border="0" width="100%">
    <tr bgcolor="#b0c4de">
    <td><b>Humidity</b>:</td>
    <td align="right">35 %</td>
    </tr>
    <tr bgcolor="#ffefd5">
    <td><b>Wind Speed</b>:</td>
    <td align="right">NE 5 MPH</td>
    </tr>
    <tr bgcolor="#b0c4de">
    <td><b>Barometer</b>:</td>
    <td align="right" nowrap>30.35&quot; (1028.1 mb)</td>
    </tr>
    <tr bgcolor="#ffefd5">
    <td><b>Dewpoint</b>:</td>
    <td align="right">20&deg;F (-7&deg;C)</td>
    </tr><tr bgcolor="#b0c4de">
    <td><b>Wind Chill</b>:</td>
    <td align="right">44&deg;F (7&deg;C)</td>
    </tr><tr bgcolor="#ffefd5">
    <td><b>Visibility</b>:</td>
    <td align="right">10.00 mi.</td>
    </tr><tr><td nowrap><b><a href="/obslocal.php?warnzone=TNZ069&local_place=Knox+County&zoneid=EST&offset=18000" class="link">More Local Wx</a></b>:</td><td nowrap align="right"><b><a href="/data/obhistory/KTYS.html" class="link">2 Day History</a></b>:</td></tr>
    </table></td></tr>
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    USA
    Posts
    830
    Rep Power
    14
    voila

    *edit* I forgot about the part about doing it every thirty minutes . . . there's a variety of ways to handle that . . . post in the PHP forum for more on that. The script below will just grab it every time someone accesses the page with the script.

    PHP Code:
    <?php

    $NWS_page 
    file_get_contents'http://www.srh.noaa.gov/data/forecasts/TNZ069.php?warnzone=tnz069&warncounty=tnc093' );

    preg_match'/(<td[^>]*><img [^>]*src="[^"]*currentconds.+)<img [^>]*src="[^"]*radandsat/s'$NWS_page$matches );

    $current_conditions $matches[1];

    echo 
    $current_conditions;

    ?>
    put that script in a .php page and upload it to your web server.
    Last edited by JMM; November 14th, 2003 at 01:25 PM.
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    Land of Oz (East Tennessee)
    Posts
    16
    Rep Power
    0
    JMM< I appreciate the code but is there any way to make it work on a HTML page? Namely my index.htm page??? Just thought I would ask...
  14. #8
  15. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    Land of Oz (East Tennessee)
    Posts
    16
    Rep Power
    0
    Is there a way to this with some javascript so I can place the information on my index.htm page? Or am I asking for the moon

    I true newbie asking here!!
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    USA
    Posts
    830
    Rep Power
    14
    There's no way to do it with just HTML / JavaScript. And there's not going to be an easy way to get the PHP code to run in your index.htm file. But it may be very easy to rename it index.php and use the code in that.

    This is all assuming you do in fact have PHP running on your web server, but it sounds like you do. If you really can not rename the index.htm file but want to display the weather table in it, there are a variety of things you could do, such as having a PHP script write new versions of index.htm incorporating the updated weather table, or use an iframe in index.htm that loads a PHP script with the code I posted.

IMN logo majestic logo threadwatch logo seochat tools logo