Actually, I am a member of the community. My user name is mak
I remembered to login just after I posted my message :). Let me post my message again WITH formating :)
Here is the mssage
--------------------------------------------------
Hello,
First, I thank all who helped me on my previous postings. It was a great deal of help. But I still have problems :)
I was able to login the page once with the code belowe. Now it says that session has been expired. I copied this code from one of the replies. Am I doing somthiong wrong in when simulating a login? I am passing all the paramaters to the url
($url->query_form(
artist => $pm_user,
albumcode => $pm_password);
Those are the only parameters to be passed.
BTW, can someone tell me how to format the message, specially the the code, nicely like eveyone else does?
Thanks in advance
#!/usr/bin/perl -w use strict;
use LWP::UserAgent;
use URI::URL;
use HTTP::Cookies;
# put your perlmonks username and password here
my $pm_user='';
my $pm_password='';
#instantiate new user agent
my $WWWAgent = new LWP::UserAgent();
# attach cookiejar to user agent
my $co=new HTTP::Cookies(file=>'./cookies.dat',autosave=>1);
$WWWAgent->cookie_jar($co);
# build request to simulate login
my $url=new URI::URL 'http://www.genesisreports.com/genesis/user/login
+.asp';
$url->query_form(
artist => $pm_user,
albumcode => $pm_password);
my $WWWRequest = new HTTP::Request 'GET', $url->as_string() ;
# submit request
my $WWWResult = $WWWAgent->request($WWWRequest);
open (FH, ">D:\\Mustafa\\Perl\\Code\\dm.html") ||
die "Can't open file to write\n";
print FH $WWWResult->content if ($WWWResult->is_success);
close(FH);
die "Error logging in $WWWResult->code $WWWResult->message" if(!$WWWR
+esult->is_success);
#Get the login page content to test
$url=new URI::URL 'http://www.genesisreports.com/genesis/user/mypage.a
+sp';
$WWWRequest = new HTTP::Request 'GET', $url->as_string() ;
# submit request
$WWWResult = $WWWAgent->request($WWWRequest);
open (FH, ">D:\\Mustafa\\Perl\\Code\\dm1.html") ||
die "Can't open file to write\n";
print FH $WWWResult->content if ($WWWResult->is_success);
close(FH);
die "Error adding to nodelet $WWWResult->code $WWWResult->message" if(
+!$WWWResult->is_success);
|