> We have a fairly simple redirect script a url is entered, and even tho
> there are directions to not enter the "http://www"; sometimes we get it
> or "http://";... what is the simplest method to extract just the domain
> name if a "http://www.somedomain_name.com"; or
> "http://somedomain_name.com"; is enter so we can extract just the
> "somedomain_name.com"

Hmm... I've had to do something similar this in the past when writing a
'parking page' for multiple names that where sent to the same IP. The IP
hosted a perl script that needed to see which domain had been referred to
the IP via the dynamic DNS server.

Basically I'd looked into all kind of packages and stuff, but the script ran
quickest by just doing the following

my $domain = $ENV{'SERVER_NAME'};
$domain =~ s/^http:\/\/www.//;
$domain =~ s/^http:\/\///;

Regardless of what they enter, you should end up with just 'domain.tld' or
'sub.domain.tld' if the name being forward using sub domains - like many
ISPs do for free hosting space.

Hope that helps...

~Keith Szlamp
http://szlamp.com



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to