login to National Post using LWP

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


I want to download the National Post to my computer using LWP.  There are
five input fields in their login page (URL:

<input type="hidden" name="__VIEWSTATE" value="dDwxN ... Y" />
<input name="email_address" type="text" id="email_address" class="textbox"
<input name="password" type="password" id="password" class="textbox" />
<input id="chkRemember" type="checkbox" name="chkRemember" />
<input type="image" name="ibtnLogin" id="ibtnLogin" class="submitbutton"
src="cc/images/buttons/en_submit_FFFFFF.gif" alt="submit" border="0" />

The value of hidden field __VIEWSTATE is very long, more than 1900

So I write a little Perl program:

my $req = POST $url, [ __VIEWSTATE => 'dDwxN ...Y', email_address => 'valid
email address', password => 'valid login password', chkRemember => ' ',
ibtnLogin => ' ' ];
my $res=$ua->request($req,'c:\NPlogin.html');

But it cannot login with error 500 Internal Server Error.

There must be something to do with the input fields, __VIEWSTATE and

Please help.


Re: login to National Post using LWP

Ed Cheng wrote:
Quoted text here. Click to load it

VIEWSTATE (or some other field) may be time-sensitive and/or there may
be any number of cookies exchanged.

Use LiveHTTPHeaders to watch your normal login, then try to mimic it.


Re: login to National Post using LWP

On Wed, 04 Jan 2006 22:20:05 -0800, DJ Stunks wrote:
Quoted text here. Click to load it

Or use WWW::Mechanize to start from the entry page and not have to worry
about any hidden fields or cookies.

Peter Scott
http://www.perlmedic.com /
http://www.perldebugged.com /

Site Timeline