Hey! I am trying to get LWP to work with this website however its not going too well. I think I am able to login, but it then redirects me to the login page again.


Note: This is test data. I don't acutally use this login info.
Your User ID : petnuc@cooper.edu
Your Password : vhNVf0jH
URL : https://noii.nasdaqtrader.com


And here is my code:

#!/usr/local/bin/perl -w use strict; use LWP::UserAgent; use HTTP::Cookies; my $browser = new LWP::UserAgent; $browser->cookie_jar( HTTP::Cookies->new( 'file' => "$ENV{HOME}/.cookies.txt", 'autosave' => 1) ); my $url = 'https://noii.nasdaqtrader.com'; my $response = $browser->post($url, [ txtUserName => '*****', txtUserPass => '*****' ] ); while($response->is_redirect) { my $location = $url . $response->header("location"); $response = $browser->get($location); if($response->is_success) { print $response->content; } else { print $response->status_line; } }
I am not really sure what I am doing wrong and why it is not going onto the next page. I though it was a redirct issue cause when I first tried it I was getting 302 errors, but this approad is not working either. Any clues? Thanks.

Edited 2004-08-04 by Ovid -- hid username and password

In reply to LWP and Site Logins by debiandude

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.