Page needing scraped: http://www.crh.noaa.gov/hazards/dmx I want to pull the information in the table on the right had side of the page-- the text under the following headers: Tornado Warning(s) Severe Thunderstorm Warning(s) Flash Flood Warning(s) How should the following code be edited to pull the information under each header (without pulling the actual heading ((Tornado Warnings, etc))... I only need the information in the white space underneath each header.... whether it read "None" or give a list of counties affected by each warning). The following code is from a different part of my site... I just need to know how to edit it to pull the above-stated information. <? $weather = file_get_contents('http://www.crh.noaa.gov/hazards/dmx'); $weather = strstr("$weather","</div>"); preg_match_all('/<b>(.*)<br> /', $weather, $forecast); $count = count($forecast[1]); for ($row = 0; $row < $count ; $row++) { echo "<b>".$forecast[1]["$row"]."<br>"; } ?> PHP: Sorry, I am learning PHP. Thanks for any help!!
Second EDIT: I have made a couple changes to the code! It worked ok when there was only one result for "Des Moines, IA". However checking another location with several storms revealed a couple of problems. I have added "(s)" to correct where the string starts. The preg_match_all now apears to work ok when several results are displayed (I am not using the Des Moines, IA location for my test though). Please note that some NOAA locations will result in counties from more than one state being displayed. Also for other NOAA locations "CDT" (time zone) may need to be changed. I hope this helps! Check the page source to find beginning and ending points for the additional strings (tornado & flood). <? function weather() { $weather = file_get_contents('http://www.crh.noaa.gov/hazards/dmx'); //Start string at "Severe Thunderstorm Warning(s)" $Thunderstorm = strstr("$weather", "Severe Thunderstorm Warning(s)"); //End string at " " $Thunderstorm = substr($Thunderstorm , 0, strpos($Thunderstorm, ' ')); if (strstr("$Thunderstorm", "None")) { echo "None"; }else{ preg_match_all('/CDT">(.*)<\/a>/U', $Thunderstorm, $thunderstorm); $count = count($thunderstorm[1]); for ($row = 0; $row < $count ; $row++) { echo $thunderstorm[1]["$row"]."<br>"; } } } weather(); ?> Code (markup):