From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of ???
Sent: 27 October 2006 07:24
To: Active Perl
Subject: Download a file (Such as a.xls)
> Hi~
> Coding in cold days.
>
> <code>
> sub get
> {
> $useragent = LWP::UserAgent->new;
> $useragent->agent("A/B");
> $useragent->cookie_jar($cookie_jar);
> $useragent->requests_redirectable();
> $response = $useragent1->request(GET "$_[0]");
> $response->as_string;
> $contenttoverify=$response->as_string;
> while($_[0] =~ m!.*/(.*?)$!g){
> $nametosave=$1;
> $nametosave =~ s/\?/-/g;
> }
> open(OUT,">$nametosave.html");
> print OUT $response1->as_string;
> close OUT;
> }
> </code>
>
> This may save an HTML file, but while I'm downloading a file, I can
get a HEAD and also the binary system file > (for example: an excel
file).
> How can I divide them properly and save it as an excel file?
Why not use LWP::Simple::getstore ? Or perhaps GET from the command line
?
HTH
--
Brian Raven
_________________________________________
The information contained in this e-mail is confidential and solely
for the intended addressee(s). Unauthorised reproduction, disclosure,
modification, and/or distribution of this email may be unlawful. If you
have received this email in error, please notify the sender immediately
and delete it from your system. The views expressed in this message
do not necessarily reflect those of Atos Euronext Market Solutions.
_________________________________________
=================================
Atos Euronext Market Solutions Disclaimer
=================================
The information contained in this e-mail is confidential and solely for the
intended addressee(s). Unauthorised reproduction, disclosure, modification,
and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediately
and delete it from your system. The views expressed in this message do not
necessarily reflect those of Atos Euronext Market Solutions.
L'information contenue dans cet e-mail est confidentielle et uniquement
destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee.
Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail
vous parvient par erreur, nous vous prions de bien vouloir prevenir
l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre
systeme. Le contenu de ce message electronique ne represente pas necessairement
la position ou le point de vue d'Atos Euronext Market Solutions.
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs