It can be done with PHP using regular expressions. Basically, you can pregmatch the extensions (.com, .net, .org, etc) and then truncate everything after it.
If you are new to domains and looking to buy, sell and learn about domains then you have come to the right place. DNForum is the largest domain name community on the internet and continues to grow every day. There are over 105,000 domainers on DNForum doing everything from buying domains, selling domains, learning about domains and discussing domains. Take a minute and Register.
Register Today on DNForum IT'S FREE!Hi
I would like to show the 'domain' part of referring URLs on a web page that I'm working on. In other words - if someone is referred by..
http://www.dnforum.com/newthread.php...stthread&f=182
.. then I'd like to just show www.dnforum.com on my page.
Not sure if this is at all possible, but any help will be much appreciated!
It can be done with PHP using regular expressions. Basically, you can pregmatch the extensions (.com, .net, .org, etc) and then truncate everything after it.
http://www.php.net/parse_url
see the post #4
lol, didn't know there was already a function that does it.
Oops, my current Hosting provider doesn't support PHP![]()
But many thanks for your input, guys. I may have to consider moving my page to another hosting provider.
Meanwhile, if anyone knows how to go about this with ASP or VBscript, I'd be very greatful for any suggestions
---------------
Added message:
Just received the following VBSCRIPT suggestion at another forum:
Dim strURL, tmparray, domain
strURL = Request.ServerVariables("HTTP_REFERER")
tmparray = Split(strURL, "/")
domain = tmparray(2)
This seems to work fine, so I will use this for the time being.
Thanks again for the PHP ideas. I will certainly document them for future reference!
Last edited by Dutch; 12-18-2006 at 07:20 AM. Reason: Automerged Doublepost
It can be done with almost all serverside languages.
Bookmarks