Module Suggestions for Posting Form Data

H

Hal Vaughan

I've been searching for a module to do this. LWP comes close.
WWW::Mechanize almost does it, but I can't find one that does just what I
need.

I have data on my computer that will be transferred to a server by POSTing
it in an HTTP request (eventually in an HTTPS request, but for now testing
is on HTTP). I'm having no problem doing this in Java by specifying the
name/value pairs and POSTing the data, then reading the returned page to
make sure it was all sent properly. In Perl, though I'm having trouble
doing it. WWW::Mechanize does forms well, but it requires a pre-existing
form to have been fetched form the server first, then the fields are filled
in.

What I need to be able to do is specify name/value pairs (and some values
are actually files encoded with MIME::Base64), POST them, then read the
returned HTML page. There is no actual html page I can read with the form
there and I'd rather not have to make one up, since it's just one more
thing I'll have to change if the server has any changes done.

What module would be good (and, if possible, easy) to use for this?

Thanks!

Hal
 
C

Charles DeRykus

Hal said:
I've been searching for a module to do this. LWP comes close.
WWW::Mechanize almost does it, but I can't find one that does just what I
need.

I have data on my computer that will be transferred to a server by POSTing
it in an HTTP request (eventually in an HTTPS request, but for now testing
is on HTTP). I'm having no problem doing this in Java by specifying the
name/value pairs and POSTing the data, then reading the returned page to
make sure it was all sent properly. In Perl, though I'm having trouble
doing it. WWW::Mechanize does forms well, but it requires a pre-existing
form to have been fetched form the server first, then the fields are filled
in.

What I need to be able to do is specify name/value pairs (and some values
are actually files encoded with MIME::Base64), POST them, then read the
returned HTML page. There is no actual html page I can read with the form
there and I'd rather not have to make one up, since it's just one more
thing I'll have to change if the server has any changes done.

What module would be good (and, if possible, easy) to use for this?

HTTP::Request::Common may be what you're looking for if I've understood
correctly:

NAME
HTTP::Request::Common - Construct common HTTP::Request objects

SYNOPSIS
use HTTP::Request::Common;
$ua = LWP::UserAgent->new;
...
$ua->request(POST 'http://somewhere/foo', [foo => bar, bar => foo]);
....


HTH,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top