Hi folks, I need the php code to pull info from this page: http://mobile.weather.gov/port_mp_ns.php?select=1&CityName=Wichita&site=ICT&State=KS&warnzone=KSZ083 I need to pull only from "Last Update:" to the last day of the forecast. What should my code be? Thanks for any help!
You might try something like the following. It seems to work ok but can probably be inproved on! <? $weather = file_get_contents('http://mobile.weather.gov/port_mp_ns.php?select=1&CityName=Wichita&site=ICT&State=KS&warnzone=KSZ083'); $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:
Just noticed that you also wanted time and date. Don't have time to add that now. But will see what I can do soon.
Hopefully this will do what you need? Time and date are now included. <? $weather = file_get_contents('http://mobile.weather.gov/port_mp_ns.php?select=1&CityName=Wichita&site=ICT&State=KS&warnzone=KSZ083'); preg_match_all('/Last Update:<\/b><br>(.*)<hr>/', $weather, $update); $weather = strstr("$weather","</div>"); preg_match_all('/<b>(.*)<br>/', $weather, $forecast); echo "<b>Last Update:</b> " .$update[1][0]; echo "<br><br>"; $count = count($forecast[1]); for ($row = 0; $row < $count ; $row++) { echo "<b>".$forecast[1]["$row"]."<br>"; } ?> PHP: