CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
How do I automate an HTML form submission?

 



cell
Deleted

Jun 21, 2000, 6:26 PM

Post #1 of 2 (414 views)
How do I automate an HTML form submission? Can't Post

Below are clipped from: http://www.cpan.org/doc/manual/html/pod/perlfaq9.html#How_do_I_automate_an_HTML_form_s

If you're submitting values using the GET method, create a URL and encode the form using the query_form method:


use LWP::Simple;
use URI::URL;


my $url = url('http://www.perl.com/cgi-bin/cpan_mod');
$url->query_form(module => 'DB_File', readme => 1);
$content = get($url);

If you're using the POST method, create your own user agent and encode the content appropriately.


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


$ua = LWP::UserAgent->new();
my $req = POST 'http://www.perl.com/cgi-bin/cpan_mod',
[ module => 'DB_File', readme => 1 ];
$content = $ua->request($req)->as_string;


-----------------------------------------
Can somebody please explain to me how to automate form submition using the POST method?
Please goto http://cell.freehosting.net/arch.htm and try to create a script to submit those 5 form automaticly

Thanks in advance.


Kanji
User / Moderator

Jun 22, 2000, 6:31 AM

Post #2 of 2 (414 views)
Re: How do I automate an HTML form submission? [In reply to] Can't Post

You gave us the solution in your own post. What else do you need explained?

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

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

$ua = LWP::UserAgent->new();

$req = POST 'http://arch8.magewar.com/archmage/enter.cgi',
[
'ID' => 'wildd',
'PASSWORD' => 'asdf32',
];
$content = $ua->request($req)->as_string;</pre><HR></BLOCKQUOTE>

[This message has been edited by Kanji (edited 06-22-2000).]

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives