Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tracking URL

Status
Not open for further replies.

MajorTechie

Programmer
Mar 20, 2002
30
0
0
CA
Hi,

I'm trying to figure out how to create a tracking URL. The kind of URL that has something appended at the end
(?source=yadayada) so that you know where your users have come from. Is this usually done with CGI? I've sometimes seen it done using backend scripting, such as CGI, (although I know how to do it using ASP).

Any help would be great,

Thanks
 
remote_host()
Returns either the remote host name or IP address. if
the former is unavailable.

referer()
Return the URL of the page the browser was viewing prior
to fetching your script. Not available for all browsers.

This is an example of using the CGI.pm module to report the remote IP (or host name) or the remote user and refering page.

Code:
#!/usr/local/bin/perl
use CGI;
my $q = new CGI;
my $rh = $q->remote_host();
my $ref = $q->referer();
print $q->header,
    $q->start_html,
    &quot;RH: $rh<br />REFERER: $ref&quot;,
    $q->end_html;

'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top