develooper Front page | perl.libwww | Postings from January 2001

Posting files to a secure site

Thread Next
From:
sdavis35
Date:
January 17, 2001 13:56
Subject:
Posting files to a secure site
Message ID:
OF8588BF03.72B47285-ON852569D7.00771D34@com
I need to post text files to a secure web site.  All the information I have
is the following:

URL (https://some URL)
the username
the password

I have been messing around with the following sample code that I found...
but it doesn't seem to be fulfilling my needs since I don't know of any cgi
script on the server side.  Is there information I am missing that is
necessary for me to post text files to this site?  Can anyone point me to
sample code that will help me?


use LWP::Simple;
use URI::URL;
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
$ua = LWP::UserAgent->new(); #create a user agent
#post the message to the server
#this will activate the program that needs to run
#in this program, reciever.pl will run on the server side
$streamstring = "string to be passed to the server";
my  $req = POST 'http://3.212.228.149/cgi-bin/reciever.pl',[Filecontents =>$streamstring];
$req->content_type('application/x-www-form-urlencoded');
$req->content('match=www&errors=0');
#content is what the server sends back after processing
$content = $ua->request($req)->as_string;
print $content;

Thanks,
Sammy Davis


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About