OK, I have tried a bit but no success. I put up a temporary webpage with this code:
Code:
http://dreamland4.gotdns.org/~ephracis/cookies.php:
<?
echo "Foo: < " . $_COOKIE['foo'] . " ><br>\n";
echo "UA : < " . $_SERVER['HTTP_USER_AGENT'] . " ><br>";
?>
I visit the page with Firefox and it looks like:
Quote:
Foo: < >
UA : < Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8b2) Gecko/20050524 Firefox/1.0+ >
|
I have this perl program:
Code:
#!/usr/bin/perl
require LWP::UserAgent;
$ua = new LWP::UserAgent(agent => 'Mozilla/4.0 ()', 'cookie_jar' => {file => "/home/ephracis/programming/perl/cookies.txt"} );
$request = new HTTP::Request('GET', 'http://dreamland4.gotdns.org/~ephracis/cookies.php');
$response = $ua->request($request, \&callback, 4096);
sub callback {
my($data, $response, $protocol) = @_;
print "$data \n";
}
It uses this cookie-file:
Code:
#LWP-Cookies-1.0
Set-Cookie3: foor=bar; path="~ephracis"; domain="dreamland4.gotdns.org"; path_spec; expires="2005-07-20 10:10:10Z"; version=0
I run the perl program and get this output:
Code:
$ ./fetchcookies.pl
Foo: < ><br>
UA : < libwww-perl/5.53 ><br>
Am I missing something here? Shouldn't at least the user agent change?