Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I tried using this code. It saved the cookies to a file, but I don't know how to use them or if I have to use them. But I think I am posting properly, but at the end of the code where I GET the data, it just gives me 'guest' data as if I didn't log in.
use HTTP::Response; use HTTP::Request; use LWP::UserAgent; use HTTP::Request::Common; use HTTP::Cookies; $login = "username"; $password = "password"; $action = "http://login.yahoo.com/config/login"; $cookie_file = "d:/perl/yahoo_cookie.txt"; $cookie_jar = HTTP::Cookies->new(file=>"$cookie_file"); $ua = LWP::UserAgent->new(); $ua->agent("Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)"); $ua->timeout(600); $ua->cookie_jar(HTTP::Cookies->new(file => "$cookie_file", autosave => + 1)); $response= $ua->request(POST $action,[ '.tries'=>"1", '.done'=>"http://baseball.fantasysports.yahoo.com/baseball", '.src'=>"", 'lg'=>"us", '.intl'=>"us", 'login'=>$login, 'passwd'=>$password, '.chkp'=>"Y"]); $cookie_jar->extract_cookies($response); $content = $response->content(); print $response->as_string; $team1 = "http://baseball.fantasysports.yahoo.com/baseball/show?pag +e=roster&lid=23413&mid=2"; use LWP::Simple; $content2 = get($team1); print $content2;
Is there something wrong with this? Am I GETing the data of the next page properly? By the way I am trying to do all of this in a DOS window. Can I do it that way? By the questions I am asking, I'm sure you can tell that I am new to this. I hope you can help. Thanks.

In reply to Re: Re: I am trying to access data from a site that needs login and password by aykes
in thread I am trying to access data from a site that needs login and password by aykes

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others browsing the Monastery: (4)
    As of 2020-07-07 05:11 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?