LClarke has asked for the wisdom of the Perl Monks concerning the following question:
I've been at this for ages, and I just can't seem to get it to work.
I am attempting to retrieve the EGLL.TXT file via FTP using Perl, and put it into a specific folder on my server. I can connect to the server, I can even see the file (ftp://tgftp.nws.noaa.gov/data/observations/metar/stations/EGLL.TXT) online, but I can't get it to pull onto my server when I run the script.
The code:The error:# Log into the ftp # my $ftp; $ftp = Net::FTP->new("tgftp.nws.noaa.gov"); $ftp->login("anonymous", "anonymous") or die "login error"; $ftp->cwd("data/observations/metar/stations") or die "cwd failed"; $ftp->ascii; $ftp->get("$station_name.TXT", "../area/weather/$station_name.TXT") or + die "failed to retrieve file $station_name.TXT"; $ftp->quit; # End ftp session #
./get_weather.pl EGLL failed to retrieve file EGLL.TXT at ./get_weather.pl line 31.
Any insight at all is going to rock my world. Thank you in advance.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl FTP troubles
by marto (Cardinal) on Apr 16, 2016 at 09:17 UTC | |
by LClarke (Initiate) on Apr 16, 2016 at 10:44 UTC | |
by marto (Cardinal) on Apr 16, 2016 at 10:58 UTC | |
by LClarke (Initiate) on Apr 16, 2016 at 19:02 UTC | |
by marto (Cardinal) on Apr 18, 2016 at 10:00 UTC |