Web Analytics Made Easy -
StatCounter Host Environment Variable Question - CodingForum

Announcement

Collapse
No announcement yet.

Host Environment Variable Question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Host Environment Variable Question

    I use the host environment variable to identify the host in a script that runs on 2 domains, one parked on the other. When I run the following code, there is no www. at the beginning of the string.

    Code:
    #!/usr/bin/perl 
    use CGI;
    my $host = $ENV{'HTTP_HOST'};
    print "Content-type: text/html\n\n";
    print "$host";
    But, when I use it in an email address, it adds a www.

    Code:
    mymail= "someone\@$host";
    Looks like this: [email protected]www.somesite.com

    Why does it do that?

  • #2
    I figured it out. If the visitor types in www. the host variable shows the www.
    I'll just use a regex to remove the www. if it exists.
    Last edited by netroact; Sep 23, 2006, 10:31 PM.

    Comment

    Working...
    X