#!/usr/bin/perl # Script to emulate a browser for posting to a # CGI program with method="POST". # Specify the URL of the page to post to, needet to go straight to login. my $URLtoPostTo = "http://www.afoto.com/wordpress/wp-login.php"; my $postieURL = "http://www.afoto.com/wordpress/wp-content/plugins/postie/get_mail.php"; my $BrowserName = "Opera/9.20 (Windows NT 5.1; U; en)";#of COURSE you are using Opera, no? # It's a good habit to always use the strict module. use strict; use LWP::UserAgent; use HTTP::Request::Common; use HTTP::Cookies; # Create the browser that will post the information. my $Browser = new LWP::UserAgent; # To make POST redirectable uncomment the following line #push @{ $Browser->requests_redirectable }, 'POST'; #Insert the browser name, if specified. if($BrowserName) { $Browser->agent($BrowserName); } my %Fields = ( "log" => "admin", "pwd" => "your_admin_password_here", ); #NEW COOKIE_JAR - try borrowing cookies from Netscape my $cookie_jar=HTTP::Cookies->new ('file' => "jadajada.txt", 'autosave' => '1'); #This will store the cookies we need to work as ADMINISTRATOR $Browser->cookie_jar($cookie_jar); # Post the information to the CGI program. my $Page = $Browser->request(POST $URLtoPostTo,\%Fields);#[ sleep(0.5); #Now that our UserAgent is cookied we can go trigger Postie! my $Post = $Browser->request(GET $postieURL); # Uncomment to print the returned page (or an error message) for debugging. print "Content-type: text/html\n\n"; #print "Hello===============================================\n\n"; #print $Page->headers_as_string(); #print "==============================================================\n\n"; #print $Post->content; #print "==============================================================\n\n"; #print $Page->message; #print "\n\nCookies anyone?\n"; #print $Browser->cookie_jar->as_string; # end of script