Jump to content

Ripping forecast information


michael.davis

Recommended Posts

Hi Everyone!

 

I am looking to write some code to rip the National Weather Service forecast images to create a separate page.  I just want the images and the temperatures that goes with it that is at the top of the page..

 

http://forecast.weather.gov/MapClick.php?lat=36.274171699242515&lon=-86.55715942382812&site=ohx&unit=0&lg=en&FcstType=text

 

Within this link there is a table that has these images and forecast information.

 

Can anyone get me started on how to scrape just the table from the webpage?

 

Example of the table is below:

 

<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr valign ="top" align="center">
<td width="11%"><b>Tonight<br></b><br><img src="/images/wtf/nfew.jpg" width="55" height="58" alt="Mostly Clear" title="Mostly Clear" ><br>Mostly<br>Clear<br>Lo <font color="#0033CC">65 °F</font></td><td width="11%"><b>Friday<br></b><br><img src="/images/wtf/hi_tsra20.jpg" width="55" height="58" alt="Slight Chance Thunderstorms Chance for Measurable Precipitation 20%" title="Slight Chance Thunderstorms Chance for Measurable Precipitation 20%" ><br>Slight Chc<br>Tstms<br>Hi <font color="#FF0000">90 °F</font></td><td width="11%"><b>Friday<br>Night</b><br><img src="/images/wtf/hi_ntsra20.jpg" width="55" height="58" alt="Slight Chance Thunderstorms Chance for Measurable Precipitation 20%" title="Slight Chance Thunderstorms Chance for Measurable Precipitation 20%" ><br>Slight Chc<br>Tstms<br>Lo <font color="#0033CC">67 °F</font></td><td width="11%"><b>Saturday<br></b><br><img src="/images/wtf/sct.jpg" width="55" height="58" alt="Mostly Sunny" title="Mostly Sunny" ><br>Mostly<br>Sunny<br>Hi <font color="#FF0000">90 °F</font></td><td width="11%"><b>Saturday<br>Night</b><br><img src="/images/wtf/nsct.jpg" width="55" height="58" alt="Partly Cloudy" title="Partly Cloudy" ><br>Partly<br>Cloudy<br>Lo <font color="#0033CC">66 °F</font></td><td width="11%"><b>Sunday<br></b><br><img src="/images/wtf/sct.jpg" width="55" height="58" alt="Mostly Sunny" title="Mostly Sunny" ><br>Mostly<br>Sunny<br>Hi <font color="#FF0000">90 °F</font></td><td width="11%"><b>Sunday<br>Night</b><br><img src="/images/wtf/nfew.jpg" width="55" height="58" alt="Mostly Clear" title="Mostly Clear" ><br>Mostly<br>Clear<br>Lo <font color="#0033CC">66 °F</font></td><td width="11%"><b>Monday<br></b><br><img src="/images/wtf/few.jpg" width="55" height="58" alt="Sunny" title="Sunny" ><br>Sunny<br><br>Hi <font color="#FF0000">91 °F</font></td><td width="11%"><b>Monday<br>Night</b><br><img src="/images/wtf/nfew.jpg" width="55" height="58" alt="Mostly Clear" title="Mostly Clear" ><br>Mostly<br>Clear<br>Lo <font color="#0033CC">67 °F</font></td></tr>
</table>

 

 

I can pull it in.  I am not too sure how to scrape just the table information with this data in it.

 

Thanks for your help!

Mike

Link to comment
Share on other sites

Continuing on with some research....

 

The area that I need to scrape is the sixth table on the page.  Can anyone point me in the right direction on how to pull just that table in?

 

<?php
$data = file_get_contents('http://forecast.weather.gov/MapClick.php?lat=36.274171699242515&lon=-86.55715942382812&site=ohx&unit=0&lg=en&FcstType=text');
echo $data;
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.