That url is not what you think it is, it goes to 404. Sadly that page is generated from the previous page at
http://www.deviantart.com. Anyway get the action and method of the page, and the names of the login fields and send them in a POST method. You may consider using
WWW::Mechanize as it makes this a little bit easier.
The form is a POST, and you should probably pass in the
username,
password,
ref (set to
http://www.deviantart.com), and
reusetoken (set to
1) fields to the form which is
https://www.deviartart.com/users/login/). You'll need to store the cookies from that transaction and pass them along with any requests you make to other pages.
use strict;
use warnings;
use LWP;
use HTTP::Request::Common qw(POST);
my $cookies = {};
my $ua = LWP::UserAgent->new( cookie_jar => $cookies,
agent => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT
+5.1');
my $req = POST 'https://www.deviantart.com/users/login',
[ username => $mydauser,
password => $mydapass,
reusetoken => 1,
ref => 'http://www.deviantart.com'];
my $response = $ua->request($req);
print $response->content;
This is how it should work,, you may need to set a proper User Agent and such. I have also arranged for a cookie-jar to store your cookies. See
LWP::UserAgent for more details.
Update: I changed the target of the POST to be
https://www.deviantart.com/users/login from
https://www.deviantart.com/users/login/ as
login/ returned 404.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.