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:
sending html form data

 



yidskki
New User

Jun 23, 2008, 8:59 PM

Post #1 of 3 (305 views)
sending html form data Can't Post

this was a little script i was making, just to learn how to interact with the web in perl. As you can see, i have filled in the forms, but i need to know how to submit them, then interact with pages inside the member area in a similar fashion. kthnx

#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;


%userlogin = ( "wpName" , $username,
"wpPassword" , $password );


my $url = 'http://www.encyclopediadramatica.com/index.php?title=Special:Userlogin&returnto=Special:Userlogout/';
my $username = 'username';
my $password = 'password';
my $ua = LWP::UserAgent->new;
$ua->agent('Mozilla/5.0');
$ua->timeout(10);
$ua->env_proxy;

my $response = $ua->get($url);

%userlogin = ( "wpName" , $username,
"wpPassword" , $password);




if ($response->is_success) {
print "connected to $url\n";
}
else {
print "failed to connect to $url";
die $response->status_line;
}

my $response2 = $ua->post( $url, \%userlogin );

if ($response->is_success) {
print "sent userlogin form to $url\n";
}
else {
print "failed to send userlogin form to $url\n";
die $response->status_line;
}


meloyelo
User

Jun 23, 2008, 10:37 PM

Post #2 of 3 (302 views)
Re: [yidskki] sending html form data [In reply to] Can't Post

Use WWW::Mechanize - then you don't have to worry about encode the form data.


yidskki
New User

Jun 24, 2008, 7:06 AM

Post #3 of 3 (298 views)
Re: [meloyelo] sending html form data [In reply to] Can't Post


In Reply To
Use WWW::Mechanize - then you don't have to worry about encode the form data.

at this moment in time, WWW::Mechanize does not work on windows.

 
 


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

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