Forum Stats

  • 3,827,682 Users
  • 2,260,803 Discussions


Perl: Login using Mechanize module

866420 Member Posts: 1
edited Aug 29, 2013 3:05PM in PHP

I'm working on a application that return a status of a website. For example, when i provide a link '' in the application, it scans each and every link inside it and it also scans links inside parent link, links inside the child link, links inside the sibling link, it goes on until it end. Now my problem is, I couldn't access the secure pages of the site, i.e. which needs authentication. I have the following code,

#! "C:\perl\bin\perl.exe"

use strict;
use warnings;
use WWW::Mechanize;
use HTTP::Cookies;
use HTTP::Request::Common;
use Crypt::SSLeay;

my $url = "";

my $mech = WWW::Mechanize->new();
$mech->proxy('http', '');

my $username = 'my_email';
my $password = 'my_password';

my $testva = $mech->get($url);


print $mech->status;
print $mech->content;

it throws a error "Can't call method "value" on an undefined value at C:/Perl/lib/WWW/ line 1403.". I don't know what does it exactly means. I tried it with other links like twitter,

my $url = "";


In this instance, it works fine and print the content and status.

Please help me out this!!
Thanks in Advance.


Edited by: 863417 on Jun 3, 2011 4:12 AM


This discussion has been closed.