Previous Thread
Next Thread
Print Thread
Rate Thread
#227647 11/10/2002 10:04 PM
Joined: Jun 2002
Posts: 303
Enthusiast
Enthusiast
Joined: Jun 2002
Posts: 303
I'm working on a script which pulls tide data from NOAA, parses it and the inserts into my PAL page. You can see it working at http://www.fish-tails.net

Anyway, I need a little help on regexp, and maybe some suggestions.

Ideally, I would like to pull the data from NOAA, strip html completely out, and then insert the data into mysql. Once the data is stored, I can then write a script so that the user can select the reference stations they want to be displayed on the home page, or in their My Home.

Currently, I have it loading directly to the home page without stripping html. Here is the code I'm using.

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://www.co-ops.nos.noaa.gov/tides/seFB.html';
$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=1
9&hh=*0.84&hl=*0.65';

$lines_array = file($url);

$lines_string = implode('', $lines_array);
eregi("$tide1(.*)$tide5", $lines_string, $head);
//eregi("<BODY BGCOLOR="#FFFFFF">(.*)</body>", $lines_string, $head);
//eregi("<pre>(.*)</pre>", $lines_string, $head);

//$head = eregi_replace("</tr><tr><td align="right" width="60">$tide5</td></tr>", "</tr>", $head);



echo "I'm running some tests now on the tides program I'm writing. Please use these with discretion. Thanks. DATA from NOAA";
echo "<br><b>Simpson Creek, A1A highway bridge 2002 Water Level Predictions</b>";
echo "<br>(Reference station - Fernandina Beach)";
echo "<br>Corrections - Time Diff. (High 0 hr. 05 min. Low 0 hr. 19 min.)";
echo "<br>Hgt. Diff. (High *0.84 Low *0.65)";
echo "<br>All times listed are in Local Time, and all heights are in Feet referenced to Mean Lower Low Water (MLLW).";
echo "<br><hr><table><tr>";
echo "<th width="60">Date</th><th width="60">Time</th><th></th><th width="40">Ht.</th><th>     
</th><th>Time</th><th></th><th width="40
">Ht.</th><th>     
</th><th>Time</th><th></th><th width="40
">Ht.</th><th>     
</th><th>Time</th><th></th><th width="40
">Ht.</th></tr><tr><td>";

echo "<font face='arial'>";


echo $head[0];


echo "</td></tr></table>";



You will note I have two $url with one commented out. The one that is commented is the one I think woul be the easiest to work with, but then I'm not sure, which is why I'm here.

The second one is the one that I'm using on my home page. Now, first off, I only want 4 days displayed, but if you look at my home page a new line with a fifth day starts. I've tried preg_replace and ereg_replace but to no avail. Anyone have a good understanding of regexp that can help me out?

Regarding the database. Looking for suggestions here. Should I set up a cron (I have an idea what it does but have never used it) to pull the data I want nightly, insert it into a db as one record, then have my pal box pull from that record? I would think that way there would be faster page load times. I'm open for suggestions here.

Any help is appreciated.

Sponsored Links
Entire Thread
Subject Posted By Posted
data retrieval - public domain fishtails 11/11/2002 5:04 AM
Re: data retrieval - public domain smilesforu 02/03/2003 2:36 PM
Re: data retrieval - public domain fishtails 02/03/2003 11:33 PM
Re: data retrieval - public domain smilesforu 02/04/2003 12:10 AM
Re: data retrieval - public domain dimopoulos 02/04/2003 12:14 AM
Re: data retrieval - public domain fishtails 02/04/2003 12:25 AM
Re: data retrieval - public domain smilesforu 02/04/2003 12:50 PM
Re: data retrieval - public domain smilesforu 02/07/2003 4:54 AM
Re: data retrieval - public domain smilesforu 02/07/2003 8:57 AM
Re: data retrieval - public domain fishtails 02/07/2003 7:37 PM
Re: data retrieval - public domain smilesforu 02/08/2003 3:09 AM
Re: data retrieval - public domain smilesforu 02/08/2003 7:43 AM
Re: data retrieval - public domain fishtails 02/08/2003 7:20 PM
Re: data retrieval - public domain smilesforu 02/09/2003 10:45 AM
Re: data retrieval - public domain fishtails 02/09/2003 3:17 PM
Re: data retrieval - public domain smilesforu 02/10/2003 8:20 AM
Re: data retrieval - public domain smilesforu 02/12/2003 4:27 AM
Re: data retrieval - public domain smilesforu 02/12/2003 12:45 PM
Re: data retrieval - public domain smilesforu 02/25/2003 12:28 PM
Re: data retrieval - public domain chillin 03/01/2003 8:10 AM
Re: data retrieval - public domain chillin 03/01/2003 11:10 PM
Re: data retrieval - public domain smilesforu 11/04/2003 11:29 AM
Re: data retrieval - public domain smilesforu 12/14/2003 4:19 AM
Re: data retrieval - public domain omegatron 12/14/2003 6:27 AM
Re: data retrieval - public domain smilesforu 12/14/2003 6:47 AM
Re: data retrieval - public domain fishtails 12/25/2003 12:38 AM
Re: data retrieval - public domain smilesforu 12/25/2003 8:10 AM
Re: data retrieval - public domain omegatron 12/25/2003 2:28 PM
Re: data retrieval - public domain smilesforu 12/26/2003 4:14 AM
Re: data retrieval - public domain omegatron 12/26/2003 5:28 AM
Re: data retrieval - public domain fishtails 12/27/2003 10:54 AM
Re: data retrieval - public domain smilesforu 12/27/2003 12:33 PM
Re: data retrieval - public domain smilesforu 01/12/2004 10:59 PM
Re: data retrieval - public domain fishtails 01/13/2004 3:12 AM
Re: data retrieval - public domain smilesforu 01/13/2004 11:35 AM
Re: data retrieval - public domain fishtails 01/13/2004 5:46 PM
Re: data retrieval - public domain smilesforu 01/13/2004 11:24 PM
Re: data retrieval - public domain YakFool 12/22/2004 5:31 AM

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Ruben Rocha
Ruben Rocha
Lutz,FL,USA
Posts: 254
Joined: January 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)