2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by hashinclude
0

yes it can be done
you could try something like this:

<?php

$ftp = ftp_connect('polar.ncep.noaa.gov');
ftp_login($ftp, "anonymous", "");
ftp_get($ftp, 'akw.46001.bull', '/pub/waves/latest_run/akw.46001.bull', FTP_ASCII);
ftp_close($ftp);

$file = file('akw.46001.bull');
	
echo '<pre>';
	
foreach($file as $line)
	{	
		echo $line;
	}
	
echo '</pre>';
	
?>

this downloads the file, reads it into an array type variable ($file). And then it simply displays the contents of that variable.

hope this helps :)

0

yes it can be done
you could try something like this:

<?php

$ftp = ftp_connect('polar.ncep.noaa.gov');
ftp_login($ftp, "anonymous", "");
ftp_get($ftp, 'akw.46001.bull', '/pub/waves/latest_run/akw.46001.bull', FTP_ASCII);
ftp_close($ftp);

$file = file('akw.46001.bull');
	
echo '<pre>';
	
foreach($file as $line)
	{	
		echo $line;
	}
	
echo '</pre>';
	
?>

this downloads the file, reads it into an array type variable ($file). And then it simply displays the contents of that variable.

hope this helps :)

thanks for that hash, so then where would I start extracting the data from the file so it becomes individual variables.

Would I use some type of loop that goes through the text? For instance I eventually want to plot this data into a graph so I would be looking to create a XML file with different variables and there values i.e myvar1 = 5.6 myvar2 = 3.4 etc etc

0

thanks for that hash, so then where would I start extracting the data from the file so it becomes individual variables.

Would I use some type of loop that goes through the text? For instance I eventually want to plot this data into a graph so I would be looking to create a XML file with different variables and there values i.e myvar1 = 5.6 myvar2 = 3.4 etc etc

exactly, you iterate through the array then filter out the information you want using regular expressions with preg_match() or preg_match_all()

:)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.