Program that download ZIP file from web?

G

Guest

I make program that download ZIP file from web.
Why downloaded file isn't ZIP file?
Why file has different size?
If I make download from IE I downloaded file is ZIP file?

IE-downloaded file size is 495.306 bites long.
Perl-downloaded file size is 497.098 bites long.

Please help me.

Thanks.



Perl program
--------------------------

# c:\perl\bin\perl.exe
#
#

use warnings;
use strict;
use WWW::Mechanize;

use CGI;
my $cgi = CGI->new();
my $form = $cgi->Vars;
my $agent = WWW::Mechanize->new();

$agent->get('http://www.ve-mil.hr/korisnici/Login.aspx');
$agent->form_number('1');
$agent->field('EmailTextBox','user22');
$agent->field('LozinkaTextBox','********');
$agent->submit();
$agent->get('http://www.ve-mil.hr/download.aspx?Item=Cjenik_Zip');
open (FF, ">Cjenik.zip");
print FF $agent->content();
 
J

Josef Moellers

I make program that download ZIP file from web.
Why downloaded file isn't ZIP file?
Why file has different size?
If I make download from IE I downloaded file is ZIP file?

IE-downloaded file size is 495.306 bites long.
Perl-downloaded file size is 497.098 bites long.

Please help me.

Thanks.



Perl program
--------------------------

# c:\perl\bin\perl.exe
#
#

use warnings;
use strict;
use WWW::Mechanize;

use CGI;
my $cgi = CGI->new();
my $form = $cgi->Vars;
my $agent = WWW::Mechanize->new();

$agent->get('http://www.ve-mil.hr/korisnici/Login.aspx');
$agent->form_number('1');
$agent->field('EmailTextBox','user22');
$agent->field('LozinkaTextBox','********');
$agent->submit();
$agent->get('http://www.ve-mil.hr/download.aspx?Item=Cjenik_Zip');
open (FF, ">Cjenik.zip");
print FF $agent->content();

How do you know whether the get() succeeded?
What does $agent->success() return?
What _is_ in the ZIP file?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,201
Messages
2,571,048
Members
47,651
Latest member
VeraPiw932

Latest Threads

Top