freelanceprogrammers.org Forum Index » Perl
How can PERL access client cookie info.
Joined: 21 Feb 2002
Posts: 1
How can PERL access client cookie info.
I am trying to create a subroutine that access
the client cookie reads past sites and adds some
information... can someone turn me onto a simple script that
illistrats this process? PLEASE??<br><br>Thanks,<br>mark
Joined: 18 Feb 2002
Posts: 7
How can PERL access client cookie info.
However you do it, you will only be able to read
cookies that your site has placed on the client`s
machine.<br><br>Anyway, for a start, try playing around with
$ENV{HTTP_COOKIE} or have a look at Matts Script Archive:
<a href=http://www.worldwidemart.com/scripts/
target=new>http://www.worldwidemart.com/scripts/</a><br><br>Greg
Joined: 22 Feb 2002
Posts: 2
How can PERL access client cookie info.
Here is a very simple subroutine used to parse
cookie data into a Hash:<br><br>sub parseCookies
{<br> my %cookie;<br> my $cdata =
$ENV{`HTTP_COOKIE`};<br> my @cookies = split(/; /,$cdata);<br> foreach $i
(@cookies) {<br> ($cname,$cid) =
split(/=/,$i);<br> $cookie{$cname} = $cid;<br> }<br> return
%cookie;<br>}<br><br>You
would use it like this:<br>my %cookies =
&parseCookies;<br><br>You may need to add extra code to remove any
URL-encoding in the cookies. Hope this helps.
All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
China Wholesale - Electronics Products
Character Studio - Tutorials and Help
China Wholesale - Electronics Products
Character Studio - Tutorials and Help







