warrior32
asked on
Perl: LWP Post request
In perl, using
my $ua = LWP::UserAgent->new();
how would I create a POST request using the below as the data to POST. I am having trouble formulating the request.
The URL to call is http://mystorage.host.company.com/storage/1234
POST /storage/1234 HTTP/1.0
Host: mystorage.host.company.com
Content-Type: multipart/form-data; boundary=BOUNDARY
Content-Length: 289
--BOUNDARY
Content-Disposition: form-data; name="data"; filename="texas.txt"
Content-Type: text/plain
--BOUNDARY--
my $ua = LWP::UserAgent->new();
how would I create a POST request using the below as the data to POST. I am having trouble formulating the request.
The URL to call is http://mystorage.host.company.com/storage/1234
POST /storage/1234 HTTP/1.0
Host: mystorage.host.company.com
Content-Type: multipart/form-data; boundary=BOUNDARY
Content-Length: 289
--BOUNDARY
Content-Disposition: form-data; name="data"; filename="texas.txt"
Content-Type: text/plain
--BOUNDARY--
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Any idea on how to put the code together?
ASKER
if using something like the following code
my $req = HTTP::Request->new(POST => $URI);
$req->content_type($conten tType);
how would I pass in the values under Boundary?
--BOUNDARY
Content-Disposition: form-data; name="data"; filename="texas.txt"
Content-Type: text/plain
--BOUNDARY--
Would I need to use the $req->content function? If so how would I use it?
my $req = HTTP::Request->new(POST => $URI);
$req->content_type($conten
how would I pass in the values under Boundary?
--BOUNDARY
Content-Disposition: form-data; name="data"; filename="texas.txt"
Content-Type: text/plain
--BOUNDARY--
Would I need to use the $req->content function? If so how would I use it?
ASKER
Some code examples by the person would have better than just a link
ASKER