Php Get Domain Name Only From Tld


Php Get Domain Name Only From Tld
  Forums Index
      » PHP Forums
        » » php get domain name only from tld



Php Get Domain Name Only From Tld
Post Description:
Post Tags: php, get, domain, name, only, from, tld, free php support, php scripts, php questions, php answers, programming, codes, scripts
This Post Has Been Viewed 756 Times Since Mon Mar 03, 2008 10:02 pm Posted By hostman with 4 replies
Next Post »» How to Protect Your Images from hot linking other sites
Php Get Domain Name Only From Tld
im looking for a php script or class in php so that i can split my domain name.

for example, i have this:

$string = www.wallpaperama.com

and i only want

$string = wallpaperama

but i want the script to take into considration other tld like

$string = mail.www.wallpaperama.co.uk

how can i do this?

Leave Your Comments
* Your Name

  * Your Email Address (Will Not Be Published)

* Your Comments


Add Picture To Comments
Yes No             upload
Receive Replies on my Comments
(An email will be sent to you when someone replies to your comments)

     




Comments and replies About Php Get Domain Name Only From Tld






:: 1 :: #53103 - Reply By greg sidberry On Thu May 08, 2008 2:01 pm
use a regex expression

something like: /[a-z]{0,}[.]{0,1}[w]{0,3}[.]{0,1}( regex isn't tested, but should point you in the right direction.

cheers,
greg
:: 2 :: #53104 - Reply By greg sidberry On Thu May 08, 2008 2:03 pm
regex got cutoff
/[a-z]{0,}[.]{0,1}[w]{0,3 . * ? ) \ . [a-z.]{2,7}/i
:: 3 :: #53106 - Reply By greg sidberry On Thu May 08, 2008 2:05 pm
wtf - heres my last attempt to get the full regex up - remove any spaces - the sites filter is blocking it without the filters


/[a-z]{0,}[.]{0,1}[w]{0 ( . * ? ) \ . [a-z.]{2,7} /i
:: 4 :: #53107 - Reply By greg sidberry On Thu May 08, 2008 2:23 pm
regex is getting screwed

phosphorusandlime.blogspot /2007/08/php-get-base-domain.html