Solved

HTTP_COOKIE - > PERL

Posted on 2006-10-23
2
919 Views
Last Modified: 2008-02-01
Hi

use CGI;


MAIN:
{
my $cgi = CGI->new();

#!/usr/bin/perl

$cookie = $ENV{HTTP_COOKIE}

    print "Content-type: text/html\n\n";

    print "<PRE>$cookie</PRE><P>";

}

}


when I run above script the output is

DoesThisWork="yes"; SMIDENTITY=KJ6wsaNv3X9XA1SgBFE+5ZDKGwpOdxS5G/v2nad24cB68kRclUh0PjPE9kkXOYJ8Gjq+muAmnxh6+8G2532NmzNKjG0eVj247kQO59SkfASyIZ5uf33DmMpi4YfZ+KVFsxrOAnqH+nNIt0a/eCcWyWQu0hvcVamLX/hrbdczBHlDFh1KoCyxJvGcZvniEoaGDzvAmfmBKfFwFhZaECrQoBgAxV704qjLnQIhYHI6lmTIpIHCmgj3jqzF5T9rkujz7HD62VLA2LBFAtMMtyKQltTwId8u/JvBTXufLBeVE0f5UUctB0c92TBCU7Dx5zWTW0UUEMIE40DxDYNNe/wFgLYseSfiFeJ0ULCP6XgUVqDjhxGNVoVvFjMlm2/sqyLVARGr1bYnbIT7eTPIfx5Q9Silw7cExIL817d4zQLEuBQj34nuIXFC3/p6cXMoYaBKEiOx/4wH1CopvSUTHRCikuHTxSzx8etM1OKlWB9WvRmVMHtn8jJSZ1MLf3qUx0sraDJux2ZDnpKJRdfADpAS+KzWHE5CCiLFlwL9VjIPMvac2augrt808hbTEbi0k21U5vH5ljHGTsTg2hLC6eKCAqAUeq9/FpcL; SMSESSION=UjCMUWSubpsodqEfv5TeugVB5+obytGF8uce8M1uhhrhKz8uJHFMzpKY+Ncf21pRdN+b+xyCVowoOb0RRWqZcZSeZmmZsKZNyKd5RmyrBOzPaogFyB2n8qjrg2kzLP+rdjLrnJb8/IvDViKsuohICcbua+0rTZBkB0D7z82PlwmCoIPSAaWi6cZsfNFVOs435Qpi7P3YKPpSrhMnk2UwMQZ37nhbwBSfJ2uIH4xn4ttDXJLAoZOhw030rX9ggE+/I4OCZNnvuwLB/r2mu27srsYFvrvKIsg8UO6LCJyQJqUtUYkz/VWN1vAnDTvJ5gi6+TjTZr7aPS0O6JdGFTh8LjvewQm/999mjCDSo9AYbLIrFvt/TDf2Ah7IU5TiFsn9h5Q6iCcRRAboEWgz4wOUc9SGdx6ezBF2CSB1zayxC4SulYMcAuZG4PmIrVUU/bpCjpqcxnrM4mRIM3X8q79wNwZMgS4XMyo5X6/NNIuJSST+wRDFcAxbFz8Vt+nHgKq2/veI2cLiMs9Z9V6XkGRYmMN8+0GCT/KiXwZT8E6i5cLVf/F20j61sNuo63yYiDLw/s5Fq9i+j0kIlW2UMS74/eYGr/bukaGmkMPWe6I1r60OgJhVdN/x3h70nbOAoXbix8mmF2PnT4XdN1s6q37QrBKLD+oL1IefPQK3BJWtkQo5IwLi/GktOhyOHMNPsjdpjAzUTHBbxhgx2ljN7UT8LcVjG8UaTUwFBfOKtbaFV1UPW+NU6UHx8fpiyGL3HIUe1t4fQhqCOcwY9amRy5iJt8EqswUbtTNz7wjxWikEe8tXdgZHBCH4y3XPtJcE9aGT8cUWiD6B6T9wHuYLoGbS424u5QjkmUrkwuoyAhQMJBa4WEU/qSP0TBK+l5/CiZbbKVwKE3Rhrv7BEqp2Yprrc1wKJI349Dk7hXpYuZ2XtWFWg7GFUwoWWxM8kJlS2enmXFUwx6P/I928unC+MlnzWA==; email=xyz@email.com; user_id=xyz; id=123456


I want to access email, user_id and id saperatly.
Can you please help to change code so that I can access three parameters saperatly.

Thanks
0
Comment
Question by:basirana
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 17791335
0
 
LVL 17

Accepted Solution

by:
mjcoyne earned 500 total points
ID: 17791586
#!/usr/bin/perl -w
use strict;
use CGI;

my $cgi = CGI->new();
my $cookie = $ENV{HTTP_COOKIE};

my ($email, $user_id, $id) = ($cookie =~ /email=(\w+@\w+\.\w+);\s+user_id=(\w+);\s+id=(\d+)/);
print "Content-type: text/html\n\n";
print "<PRE>$email, $user_id, $id</PRE><P>";
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question