Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Oh beloved, worshipped, sacred, holy Monks: I have written a script to grab a www page. I have to pass cookies in order to get the page. I can successfully get it, but it seems the cookies arent being used properly. I have asked around among all the perl people I know, but no one can answer this for me.
Can anyone find any problems in this code? The cookies file is correct and standardized... looks like this:
#LWP-Cookies-1.0 Set-Cookie3: id=bob_loblaw; path="/"; domain=yoursite.here.com; path_s +pec; expires="2005-12-31 23:59:33Z"; version=0 Set-Cookie3: username=blahblahblah; path="/"; domain=yoursite.here.com +; path_spec; expires="2015-11-06 08:09:49Z"; version=0
--------------------------
use strict; use warnings; use LWP::UserAgent; use HTTP::Cookies; my $rssFile = "dump.rss"; my $wwwSite = "www.your.site.here.com"; my $cookieFile = "c:/cookies.txt"; my $browser = LWP::UserAgent->new; $browser->timeout(10); $browser->env_proxy; $browser->cookie_jar(HTTP::Cookies->new(file => $cookieFile )); my $response = $browser->get( $wwwSite ); if ($response->is_success) { open RSSDUMP, ">" . $rssFile; print RSSDUMP $response->content; close RSSDUMP; } else { die $response->status_line; }

In reply to LWP::UserAgent with HTTP::Cookies problems by Alives

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 making s'mores by the fire in the courtyard of the Monastery: (6)
    As of 2021-03-03 15:41 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      My favorite kind of desktop background is:











      Results (81 votes). Check out past polls.

      Notices?