Hi I am a total newb at this but learning perl seems fun.. I am trying to login to a website the script appears to be successffull but returns strange output that is listed below it returns a script rather than a webpage?? Is there a way to go to a specific page after logging in? I want to go to the actual page you are redirected to after login. Here is my script and the output is below
use WWW::Mechanize; use HTTP::Cookies; my $outfile = "out.htm"; my $url = "***************"; my $username = "**********"; my $password = "********"; my $mech = WWW::Mechanize->new(); my $number = 2; $mech->cookie_jar(HTTP::Cookies->new()); $mech->get($url); my @names = $mech->forms(); #print @names; #mech->form_id( $name ); $mech->form_name('login_form'); #$mech->form_number($number); $mech->field(USER => $username); $mech->field(PASSWORD => $password); $mech->submit(); my $output_page = $mech->content(); print $output_page; @links = $mech->find_all_links(); foreach (@links) { print $_->url(), "\n"; print $_->text(), "\n"; print $_->name(), "\n"; print $_->tag(), "\n"; } This gives::: <!-- --> <script language="Javascript"> loc = document.URL; begin_target = loc.indexOf("TARGET="); end_target = loc.length; target = loc.substring(begin_target + 7,end_target); target = target.replace(":80",""); target = target.replace('$SM$', ''); end_site = target.indexOf('/',10); site = target.substring(0,end_site); if(end_site == -1) { end_site = target.indexOf('%2f',16); } site = target.substring(0,end_site); while( (site.indexOf('%3a')) != -1) { site = site.replace('%3a', ':'); } while( (site.indexOf('%2f')) != -1) { site = site.replace('%2f', '/'); } while( (site.indexOf('%2e')) != -1) { site = site.replace('%2e', '.'); } document.location.href = site + "/?DEST=" + target; </script>
Which is not what I want. Any ideas why I am getting this rather than an html page??

In reply to form logins by everlast88az

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.