--- Brian Jackson <[EMAIL PROTECTED]> wrote:
> Folk,
>
> I'm not looking for how to do this, but I am just curious if anyone has
> either done this or knows if it can be done.
>
> We need to capture data from a website that happens to be a text file.
> Currently we have to manually save the data via the browser, then
> manually move the txt data and process it. What I want to know is if
> commands within the Perl language will allow for me to automatically go
> to the website and save the txt file locally so that we can automate the
> processing of all of this data.
>
> Thanks in advance.
>
> Brian
Brian,
If I understood you correctly, the following untested code should give you some
pointers:
#!/usr/bin/perl -w
use strict;
use LWP::Simple;
my $file = './data/datafile.txt';
my $url = 'http://www.someserver.com/somepath/somedoc.txt';
my $data = get( $url );
if ( defined $data )
{
open OUT, "> $file" or die "Cannot open $file for writing: $!";
print OUT $data or die "Could not print to $file: $!";
close OUT or die "Could not close $file: $!";
}
else
{
warn "Could not GET data form $url";
}
Cheers,
Curtis "Ovid" Poe
=====
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/
__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]