Getting HTML from URL.

[php]

<?php $tester = file_get_contents('http://kamala.cod.edu/Canada/latest.wfcn11.CWTO.html'); //$tester contains contents to search $tornado = 'TORNADO WARNING ENDED FOR:'; $city = 'SMITHS FALLS - LANARK - SHARBOT LAKE'; if ((strpos($tester, $tornado)) && (strpos($tester, $city))) { echo '
 &nbsp
037 &nbsp
WFCN11 CWTO 231941 &nbsp
TORNADO WARNING &nbsp
ENDED BY ENVIRONMENT CANADA &nbsp
AT 3:41 PM EDT MONDAY 23 JULY 2012. &nbsp
--------------------------------------------------------------------- &nbsp
TORNADO WARNING ENDED FOR: &nbsp
SMITHS FALLS - LANARK - SHARBOT LAKE &nbsp
BARRY\'S BAY - KILLALOE &nbsp
RENFREW - ARNPRIOR - CALABOGIE. &nbsp
&nbsp
--------------------------------------------------------------------- &nbsp
==DISCUSSION== &nbsp
THE TORNADO THREAT HAS DIMINISHED. &nbsp
&nbsp
END/OSPC &nbsp
 
';
}
else 
{ 
echo '';
}
?>

[/php]

Thanks, only 1 thing. The text changes all the time. And I need it to show whatever text is one the page at the given time. That would show the text that is on the page right now…but it wouldnt automatically show the new text correct?

correct, i assume you are the owner of the given page?

The text data given away is government information…which is ok to be used by anyone…Its off the NOAAPort server from Environment Canada. I run the website that will get the data though.

right, i have a function to retrieves those information. i will be back in a couples hours.

Personal stuff time

[php]

<?php $tester = file_get_contents('http://kamala.cod.edu/Canada/latest.wfcn11.CWTO.html'); //$tester contains contents to search $tornado = 'TORNADO WARNING ENDED FOR:'; $city = 'SMITHS FALLS - LANARK - SHARBOT LAKE'; $str = substr($tester, 0, strpos($tester, 'CLICK HERE TO GO TO PREVIOUS BULLETINS.')); if ((strpos($tester, $tornado)) && (strpos($tester, $city))) { echo $str; } else { echo ''; } ?>

[/php]

Thanks, one more thing. Is there a way to get rid of the background?

[php]

<?php $tester = file_get_contents('http://kamala.cod.edu/Canada/latest.wfcn11.CWTO.html'); //$tester contains contents to search $tornado = 'TORNADO WARNING ENDED FOR:'; $city = 'SMITHS FALLS - LANARK - SHARBOT LAKE'; $tester = str_replace("http://weather.cod.edu/images/logos/nexlabgray.gif","",$tester); $str = substr($tester, 0, strpos($tester, 'CLICK HERE TO GO TO PREVIOUS BULLETINS.')); if ((strpos($tester, $tornado)) && (strpos($tester, $city))) { echo $str; } else { echo ''; } ?>

[/php]

Perfect, thanks so much for your help. I I will show you the finished product when I’m done.

Thanks, Dave

Great, so glad that i could help.

I marked the thread solved

one more thing.

Replace the following line:
[php]
$str = substr($tester, 0, strpos($tester, ‘CLICK HERE TO GO TO PREVIOUS BULLETINS.’));
[/php]

with this line:
[php]
$str = substr($tester, 0, strpos($tester, ‘<A HREF=’));
[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service