#!/usr/bin/perl use HTTP::Cookies; use WWW::Mechanize; use strict; use warnings; use diagnostics; use LWP::Debug qw(+); #Shows the transaction taking place use LWP::Simple; use HTTP::Message; #Used to hold the response from get() methods my $start_page = 'https://secure2.playboy.com/security/loginStart.do?s +c_target=cyber.playboy.com'; my $mech = WWW::Mechanize->new( agent=>"Mozilla/5.0 (X11; U; Linux i68 +6; en-US; rv:1.7) Gecko/20040918 Firefox/0.9.3 " ); my $cookie_jar = HTTP::Cookies->new(file => './lwp_cookies.dat', autos +ave => 1,); #Creating a cookie jar $mech->cookie_jar($cookie_jar); #Attaching cookie jar to the user agen +t i.e $mech $mech->get( $start_page ); #Check to see if the main login page is dled correctly if ($mech->success()==1) { print "Success \n"; } #Submitting your credentials my $response = $mech->submit_form( form_name => 'loginForm', fields => { username => 'xxxx', password => 'xxxx', savedPWAction => 'on', #submitButton => 'ENTER THE CLUB' } ); #Checking to see if credentials were submitted successfully if ($mech->success()==1) { print "Success \n"; } print $mech->content(); # Follow HTTP or META refreshes. #First refresh my $url=""; my $response2=HTTP::Message->new(); if ($url = $response->header('Refresh')) { $url =~ s/^\d+;url=//i; my $response2 = $mech->get($url); } #Second refresh my $response3=HTTP::Message->new(); my $url1=""; if ($url1 = $response2->header('Refresh')) { $url1 =~ s/^\d+;url=//i; my $response3 = $mech->get($url1); } #Checking to make sure what I see in the #broser is what perl is getting print $mech->get($url1); print $mech->content(); #Now the good stuff my $filename = "./1.jpg"; my $url3="http://cyber.playboy.com/members/playmates/files/2004/08/imx +/centerfolds/centerfold-PM200408A1-01-lrg.jpg"; print $mech->get($url3,":content_file" =>$filename);
In reply to Re: Loging into a website using javascript for login
by homer123
in thread Loging into a website using javascript for login
by homer123
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |