Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Reg expression to get referer's domain?
July 9, 2007, 7:29 pm
rate this thread
I'm using PHP 4.4.4. What is the best way (I assume regular
expressions would be involved) to get the domain from the
$_SERVER['HTTP_REFERER'] variable? By "domain" I am referring to (for
example), google.com, instead of groups.google.com. In other words, I
don't care about sub-domains.
Thanks, - Dave
Re: Reg expression to get referer's domain?
All domains are sub-domains -- the only exception is the root domain ".".
"com." is a subdomain of ".".
"google.com." is a subdomain of "com."
"groups.google.com." is a subdomain of "google.com."
"flibble.groups.google.com." is a subdomain of "groups.google.com."
Where you draw the line is entirely arbitrary.
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 19 days, 15:05.]
demiblog 0.2.0 Released