Perl CGI, posting form data

Posted on 2005-05-17
Last Modified: 2010-03-05

Anyone know how to send a form data (POST method) using perl?

I have process.php page that will accept this 2 variables :

   - username
   - password

And I need to create a perl cgi script to access the process.php with "predefined" username and password.

Right now, I use "login.html" using html form (POST method) to access that process.php

Question by:db2trade
    1 Comment
    LVL 48

    Accepted Solution

    use strict;
    use HTTP::Request::Common qw(POST);
    use LWP::UserAgent;

    my $ua = LWP::UserAgent->new;
    my $req = POST '',
                    [ username => 'user', password => 'pass' ];

    print $ua->request($req)->as_string;

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    Title # Comments Views Activity
    Remove Malware code from PHP file 6 49
    stftime format 4 47
    Problem with one substitution modifying another 3 51
    iSeries PERL Scripts 7 117
    In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (…
    Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now