I'm working on a script which pulls tide data from NOAA, parses it and the inserts into my home page. You can see it working at http://www.fish-tails.net on the home page under the Tides caption.
Anyway, I need a little help on regexp, and maybe some suggestions.
Here's my code.
$month = date("n");
$day = date("j");
$year = date("Y");
$next = (date("j")+1);
$next1 = $next+1;
$next2 = $next1+1;
$next3 = $next2+1;
$tide1 = "$month/$day/$year";
$tide2 = "$month/$next/$year";
$tide3 = "$month/$next1/$year";
$tide4 = "$month/$next2/$year";
$tide5 = "$month/$next3/$year";
$url = 'http://co-ops.nos.noaa.gov/tides/get_pred.shtml?stn=0030+Fernandina+Beach&secstn=
Simpson+Creek,+A1A+highway+bridge&thh=+0&thm=05&tlh=+0&tlm=19&hh=0.84&hl=0.65';
$lines_array = file($url);
$lines_string = implode('', $lines_array);
eregi("$tide1(.*)$tide5", $lines_string, $head);
$head = eregi_replace("</tr><tr><td align=\"right\" width=\"60\">$tide5</td></tr>", "</tr>", $head);
echo $head[0];
I just want 4 days of tides displayed, but I can't seem to cut out the beginning of the 5th day $tide5
I've tried preg_replace and ereg_replace but to no avail. Anyone have a good understanding of regexp that can help me out?
I'm open for suggestions here.
Any help is appreciated.