Connecting Tech Pros Worldwide Forums | Help | Site Map

How to get complete URL Referer

Newbie
 
Join Date: Aug 2007
Posts: 22
#1: Dec 13 '08
Hello:

Im working on a script that needs the complete URL referer to proceed accordingly to variables included after the question mark on the previous URL.EXAMPLE

Expand|Select|Wrap|Line Numbers
  1. cgi-bin/myscript.pl?first_variable=YES
But the following Environment Variable

Expand|Select|Wrap|Line Numbers
  1. $ENV{'HTTP_REFERER'}
Only prints the URL up to the question mark

Any Ideas..??

VirtualWeb
eWish's Avatar
Moderator
 
Join Date: Jul 2007
Location: Arkansas
Posts: 900
#2: Dec 13 '08

re: How to get complete URL Referer


For the query sting use $ENV{'QUERY_STRING'} which will get your everything past the '?'

--Mork
KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#3: Dec 13 '08

re: How to get complete URL Referer


What you want is to use the CGI module to parse the query string. There are a lot of security issues running scripts as a CGI and blindly importing everything sent via 'post' or 'get' or other method is unwise.
eWish's Avatar
Moderator
 
Join Date: Jul 2007
Location: Arkansas
Posts: 900
#4: Dec 13 '08

re: How to get complete URL Referer


This is very true and it is easy too.

--Mork
Reply