On Fri, 8 Nov 2002 03:00:33 -0800 (PST), [EMAIL PROTECTED]
(Admin-Stress) wrote:

>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;
#if $ua is already defined
$ua->agent('Mozilla/5.0');
$ua->agent("");  # don't identify

#or do it when you first initialize it
my $ua = LWP::UserAgent->new(agent => 'Coolbrowser-999' );

# read "perldoc 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 ?
Probably, you should keep it short.



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

Reply via email to