If the problem is indeed cookies, then you should use a module like HTTP::Cookies to store a 'cookie jar' for you. You might need to log in as well. Here is a script that i use to post comment to the Chatterbox from a terminal. Meditate upon it and see if you can write a similar script to solve your problem. You will probably not want to use Netscape cookies as well - YMWV. If you do use Netscape cookies, you will need to launch Netscape, log in to the site, and exit Netscape to save the proper cookie. Otherwise, read the HTML code for the login form and supply the proper form values in the call to POST().
use strict; use LWP; use HTTP::Request::Common; use HTTP::Cookies; print "\n: "; chomp ($_ = <>); use constant URL => 'http://www.perlmonks.org/'; my $ua = LWP::UserAgent->new; $ua->agent('chat_poster/1.0 (' . $ua->agent .')'); $ua->cookie_jar(HTTP::Cookies::Netscape->new( file => $ENV{HOME} . '/.netscape/cookies', autosave => 1 )); my $request = POST(URL, Content => [ op => 'message', message_send => 'talk', message => $_, ] ); # this is just to gain back control of the terminal # you will probably want to not fork for your problem exit if fork(); my $response = $ua->request($request);

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

In reply to (jeffa) Re: Fetching web pages using by jeffa
in thread Fetching web pages using by Baz

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.