michael.davis Posted June 15, 2012 Share Posted June 15, 2012 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 https://forums.phpfreaks.com/topic/264212-ripping-forecast-information/ Share on other sites More sharing options...
michael.davis Posted June 15, 2012 Author Share Posted June 15, 2012 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 https://forums.phpfreaks.com/topic/264212-ripping-forecast-information/#findComment-1354035 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.