|
I try to send a hidden variable that contain a file to an
other server. =
but I dunno how you could do this. Any help will be appreciated.. = please email at [EMAIL PROTECTED] thanks in advance for your = precious help and sorry for my english.. use HTTP::Request; use LWP::UserAgent; use URI::Escape; # -- Open the file containing the LM data to post. open(LMDATA, "$ARGV[0]") || die "Could not open $ARGV[0]."; # -- Read the data, build the URL-escaped string to POST. # -- Each line is of the form attribute=3Dvalue. $postString =3D ""; $postString =3D $postString . "filename=3Dfile2" . "&"; $postString =3D $postString . "DEBUG=3D1" . "&"; while (<LMDATA>) { chomp; $postString =3D $postString . uri_escape($_) . "&"; $DEBUG && print ("postString =3D $postString\n"); } close(LMDATA); =20 # -- There will be an extra & at the end; get rid of it. chop($postString); =20 $request =3D new HTTP::Request 'POST', $ARGV[1]; $request->header('Content-type' =3D> = 'application/x-www-form-urlencoded'); $request->header('Content-length' =3D> length($postString)); $request->content($postString); ua =3D new LWP::UserAgent; $response =3D $ua->request($request); if ($response->is_success() && !$response->content()) { $DEBUG && print "success\n"; } else { $DEBUG && print "unsuccessful\n"; $message =3D "LM barfed.\nresponse =3D " . = $response->as_string() . "\ncontent =3D " . $response->content . "\n"; die $message } |
