Hi,

Here I got a code to upload file to a cgi running in a webserver :

#!/usr/bin/perl
use warnings;
use strict;
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;

my $url ='http://www.mydomain.com/cgi-bin/upload.cgi';
my $file = 'testfile.dat';

my $ua = new LWP::UserAgent;

my $req = POST $url,
Content_Type => 'multipart/form-data',
Content => [
file => [$file]
];

my $res = $ua->request($req);
if ($res->is_success){print $res->as_string;
}else{print $res->status_line;
}
exit 0;

My idea is, to have a perl script to automate http upload without fill in form, etc.

My question, how can I set user-agent string? so the web server will detect as, for 
example
"COOLBROWSER 0.1" :)

And, is there any limitation for the user-agent string lenght ?

Thanks for your help.

Regards,
kapot

__________________________________________________
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to