ok well im trying to add some weather forcasts into my site. Im using a simple preg_match_all script which works for one site. But i tried to modify it for another two sites but i couldnt get them working.
The script is
<?php
$url = "the target site";
$fd = fread(fopen("$url", "r"), 100000);
if ($fd)
{
$code = preg_match_all("|<strong>(.*)</strong>|", $fd, $matches, PREG_PATTERN_ORDER);
}
else echo "connection to site failed"
?>
I want to get a forcast off
http://www.bom.gov.au/cgi-bin/wrap_fwo.pl?IDN10023.html
the forecast is between the tags <!-- IDN1002303</P> and <!-- IDN1002304</P> i.e Mid North Coastal Waters. However the preg_match only works for normal html tags right?
I tried searching using </B><B>(.*)</P><P> but didnt get very far. How should i set it up? Also is there a way to divide the match up based on the day e.g - monday...., tuesday...
the second page is http://tuncurry.yourguide.com.au/weather.asp with the target content - the tides. I tried using
|<br><font color='red'>(.*)</font><br>| But again nothing. Im only new to php. Am i doing something wrong?