Module Suggestions for Posting Form Data

Discussion in 'Perl Misc' started by Hal Vaughan, Apr 5, 2006.

  1. Hal Vaughan

    Hal Vaughan Guest

    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
    Hal Vaughan, Apr 5, 2006
    #1
    1. Advertising

  2. Hal Vaughan wrote:
    > 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,
    --
    Charles DeRykus
    Charles DeRykus, Apr 5, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff Baker

    WebClient form Posting with form name?

    Jeff Baker, Aug 28, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    736
    John Saunders
    Aug 29, 2003
  2. alanb
    Replies:
    2
    Views:
    517
    alanb
    Apr 23, 2004
  3. Rob Meade
    Replies:
    0
    Views:
    418
    Rob Meade
    Dec 1, 2004
  4. AmitKu
    Replies:
    7
    Views:
    481
    John Timney \(MVP\)
    Jan 8, 2007
  5. lightning
    Replies:
    2
    Views:
    368
    lightning
    Mar 25, 2008
Loading...

Share This Page