Perl Cookie not working
        Posted  
        
            by 
                grosseskino
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by grosseskino
        
        
        
        Published on 2011-03-20T00:08:05Z
        Indexed on 
            2011/03/20
            0:09 UTC
        
        
        Read the original article
        Hit count: 197
        
Hi!
I already spent all day looking for an answer for this:
I am using Perl with LWP::UserAgent and HTTP::Cookies.
My problem is that I can't get past an cookie-base age-check.
In Perl I use this code:
my $browser = LWP::UserAgent->new;
my $resp = $browser->get( $url, 'User-Agent' => 'MySpider/1.0' );
#Cookie Setup
my $cookies = HTTP::Cookies->new();
$cookies->set_cookie(1,'age_check', '1','/','.example.com/', 80, ,0,3354512128, 0);
$browser->cookie_jar($cookies);
The Site is setting the Cookie with JavaScript
function saveSplash(domain) {
    var expDate = new Date();
    expDate.setTime(expDate.getTime()+(1*24*3600*1000));
    setCookie("age_check", 1, expDate, '/', domain);
    setCookie("screen_width", getScreenWidth(), expDate, '/', domain);
}
This is the Cookie saved by my browser:
age_check
1
example.com/
1088
3354512128
30140182
2646218624
30139981
Any idea what I am doing wrong?
Thanks in advance guys!
© Stack Overflow or respective owner