Dear PerlMonks,
I just begun Perl about a week ago.
I program a bit in C/C++ so im only new to Perl.

The goal of the script:
I have written a script to do basic authentication
and get a html document from a website (it's just a start of a script)

The problem:
The website want's me to accept cookies before i can
continue, so i added a cookiejar to the script so that LWP::UserAgent would accept cookies.


(i got that idea from this site: http://lwp.interglacial.com/ch11_01.htm)

But when i run the script i get the error page telling me to enable cookies in my browser so that i can continue.
What am i doing wrong?

#!/usr/local/bin/perl use strict; use warnings; use LWP; use HTML::TreeBuilder; use HTML::FormatText; use HTTP::Cookies; my $url = 'https://timetables.website.x.y.z/dir/'; my $cookie_jar = HTTP::Cookies->new(); my $browser = LWP::UserAgent->new(); $browser->cookie_jar($cookie_jar); $browser->agent('Mozilla/5.0 (compatible; MSIE 7.0; Windows N +T 6.0)'); $browser->from('my email'); $browser->protocols_allowed( ['https'] ); #User Credentials for access to the website.x.y.z realm. $browser->credentials( 'timetables.website.x.y.z:443', #website and port 'timetables.website.x.y.z', #realm 'user' => 'pass' # user credentials ); my $response = $browser->get($url); die "Error at $url\n ", $response->status_line, "\n Aborting" unless $response->is_success; print "OK", $response->content_type, " document!\n"; my $content = $response->decoded_content; my $html = new HTML::TreeBuilder; $html->parse($content); my $f = new HTML::FormatText(leftmargin => 0, rightmargin => 0); print $f->format($html);
The Error Page:
Cookies are currently disabled by your browser settings.
To access this Web site, cookies must be enabled.
Follow these directions to enable cookies (Microsoft Internet Explorer 6 or later):
In Internet Explorer, on the Tools menu, click Internet Options. Click the Privacy tab, then click Sites.
In Address of Web site, type the complete address of this Web site.
For example, http://www.microsoft.com. Then click Allow.

Thanks in advance

UPDATE: Thanks for the reactions so far.
I turned off javascript and i didn't get a warning page.

im now going to diagnose the problem with live headers in FF (thanks for the tip)


In reply to The Cookiejar Problem by dmusulin

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.