Dear Monks,
I am attempting to login to facebook using WWW::Mechanize but when I test to see the resulting page using $mech->uri() it outputs the page that would result form incorrect login information. Here is the code I am using:
#!/usr/bin/perl
use strict;
use WWW::Mechanize;
my $url = "http://www.facebook.com";
my $mech = WWW::Mechanize->new();
$mech->get($url);
$mech->submit_form(
form_name => "loginform",
fields => {
email => $ARGV[0],
pass => $ARGV[1]
}
);
print $mech->uri() . "\n";
I am unclear as to why it is unable to login, assuming the info provided is valid. Also, mech-dump spits back that the return type of the other login page for facebook (not used in this script) is of content type text/plain NOT of text/html. Is that a cause for concern when using Mech?
Any help appreciated.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|