I am trying to automate my login to JetBlue Airways. I got the header information using Firefox and Tamper Data. Below is the code that I have tried using. I have a feeling it has something to do with the way i'm setting the cookie. Any help would be appreciated.
#!/usr/bin/perl -w use strict; use LWP::UserAgent; use HTTP::Cookies; #use LWP::Debug qw(+); my $url = 'https://www.jetblue.com/trueblue/ff_login.aspx'; my $client = LWP::UserAgent->new; my $signinform = $client->get($url); $signinform = $signinform->content; $signinform =~ m/__VIEWSTATE" value="(.*?)"/; my $view_state = $1; my $lwp_obj = LWP::UserAgent->new(); $lwp_obj->cookie_jar({}); my $resp = $lwp_obj->post($url, [ 'UserName' => 'testjetblue%40live.com', 'Password' => '565656', '__VIEWSTATE' => $view_state, ], 'Host' => 'www.jetblue.com', 'User-Agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; +en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13', 'Accept' => 'text/xml,application/xml,application/xhtml+xm +l,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5', 'Accept-Language' => 'en-us', 'Accept-Encoding' => 'gzip,deflate', 'Accept-Charset' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'Keep-Alive' => '300', 'Connection' => 'keep-alive', 'Referer' => 'https://www.jetblue.com/trueblue/ff_login.as +px', ); print $resp->content;

In reply to LWP Authentication by jbaez

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.