To start, it is NOT a hacking job. I want to access my USAGE report from my ISP. At the home page I have to select Account Management then login with my user name and pw from newly created prompt. One clicking login I get yet another prompt so I select usage report from dynamically displayed selection(dropdown) , then click select. That will direct me to the report page that I want to save as html. Then logout from that page. There are a lot of js and it it is not easy to navigate (The home page) but it does it's functions.

I did spend a lot of time trying on my own, using of course Machanize; but I need your help.

If someone here did a similar perl script, I will apprecite some workflow that I can initiate with your guidance.

5 Years
Discussion Span
Last Post by arishy

Here is my latest effort in the subject The two screen shots indicate when I use the link (in the code) I get the login screen , I type User and PW press login , I get the second screen. I need to save this screen as html.

use 5.010;
use strict;
use warnings;

use Win32::Internet; 
my $INET= new Win32::Internet();
$INET ->HTTP(my $HTTP, "'http://www.tedata.net/eg/en/Manage-ADSL-Account/Check-Usage'", "123456", "123456789");

my ($statuscode, $headers, $file)=$HTTP->Request("/");
say $statuscode;
say $headers;
binmode STDOUT;
print $file;



Look in to the module WWW::Mechanize

use strict;
use warnings;
use WWW::Mechanize;

my $mech = WWW::Mechanize->new;


my $site = $mech->content; #site saved as html

you can also you the module to log you in the site and do things...

Edited by wickedxter


Thank you so much for your response, here what I did following your suggestion:

use WWW::Mechanize;
my $username = '123456@tedata.net.eg'; ## watch the weired way they are designing it
my $password = "123456789"; 
my $url = "http://www.tedata.net/eg/en/Manage-ADSL-Account/Check-Usage"; 
my $mech = WWW::Mechanize->new();
$mech->form("aspnetForm"); # The Login Form Name   I am not sure
$mech->field('ctl00$ContentPlaceHolder1$Txt_ADSL_UserName', $username); # I am not sure
$mech->field('ctl00$ContentPlaceHolder1$Txt_ADSL_Password', $password); # I am not sure
$mech->click("Login"); # I am not sure

my $current_site = $mech->{uri}; 

Perl did not like my form details. The page is written in a very complicated way( also js etc)
May be you can give me a hand ( the link above can give you access to the form details).

Or may be I am doing it the wrong way all together.


try this:


use strict;
use warnings;
use WWW::Mechanize;

my $url = 'http://www.tedata.net/eg/en/Manage-ADSL-Account/Check-Usage';
my $user = '123456';
my $pass = '123456789';

my $mech = WWW::Mechanize->new();


$mech->form_number(2); #set the number 2 form as the one we want

$mech->set_fields( 'ctl00$ContentPlaceHolder1$Txt_ADSL_UserName' => $user);
$mech->set_fields( 'ctl00$ContentPlaceHolder1$Txt_ADSL_Password' => $pass);

$mech->click_button(value =>'Login' );

print $mech->content;


It worked like a charm wow. Very smart of you to use form number not text and the real one is actually reading the page code and using form 2.
I worked on it for 2 weeks
Thank you so much for taking the time and solving the problem.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.