Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extracting data from web page and inserting into mysql

Status
Not open for further replies.

Fishtails

Technical User
Feb 12, 2002
6
US
I run a fishing website and one of the things my visitors use are tide reports. I get my data from NOAA via the following code:

<?php

$url = '
$lines_array = file($url);

$lines_string = implode('', $lines_array);

eregi(&quot;<pre>(.*)</pre>&quot;, $lines_string, $head);

echo $head[0];

?>

The data is displayed in a web page at , however, this method is not practical. I would like to extract the data and insert it into mysql so that I can display the current days tides as well as the next 4 days, rather than the entire year all on one page. (slow loading, hard to read, etc.)

As you can see by the output, the data is displayed by months and is preformated (from originating URL) .

I am learning more and more on php but I'm not quite sure where to start on this one and was hoping someone could steer me in the right direction. Thanks for any info or help.
 
i saw the file and it's not hard to process.

What you just need to do is to read all the file and process the information.

read the file only once.

search the string &quot;Tide Predictions (High and Low Waters)&quot;
get the month

$details=explode(&quot; &quot;,line)
do inserts while $details[0] is a number.

loop to search the string.

Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top