Thanx Again...

So you mean to say that the below code examples the same right?



use HTTP::Cookies;
use WWW::Mechanize;

my $cookiefile = 'cookies.txt';
my $cookie_jar = HTTP::Cookies->new(File => $cookiefile, autosave =>1);
my $m = WWW::Mechanize->new( autocheck => 1 );
$m->cookie_jar($cookie_jar);
my $url="https://www.bittorrent.com/account/signin";
$m->get($url);
$m->submit_form(
      form_number => 2,
      fields      => {
         username    => 'abcd',
         password    => 'abcd',
      }
);


my $content= $m->content;

and from now you can use $m to do any thing i mean to say can i use $m to get content of any linked page inside the login page ??? something like this??

if($content =~ m/<li id=\"movies\"><a href=\"(.*?)\" title=\"Movies\"> +Movies<\/a><\/li>/i) { my $movie = $1; $m->get($movie); my $content_1 = $m->content; if($content_1 =~ m/<h3><a href=\"(.*?)\" title=\"\">Browse All +<\/a><\/h3>/i) { my $movie_1 = $1; $movie_1 \n"; $m->get($movie_1)||die ("\nCan't Get the Browse URL\n" +); my $content_2 = $m->content; if($content_2 =~ m/<li><a href=\"(.*?)\">Rent<\/a><\/l +i>/i) { my $movie_2 = $1; $movie_2=~ s/&amp;/&/g; $m->get($movie_2)||die("\nCant Get The Rent UR +L\n"); $content_3 = $m->content; } } else { print "Not Matched Rent URL\n"; } } else { print "\nSorry Not Matched Browse All\n"; }} else { print "\nNot matched Movie page\n"; }

So If any thing requires in $content_3 page requires a authentication then will my code 2ndpartremembers the earlier cookies as i have coded above see Ist part Please suggest me ....



Thanx, Shekar

In reply to Re^4: problem login using WWW::Mechanize by shekarkcb
in thread problem login using WWW::Mechanize by shekarkcb

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.