Previously, Richard Kurth said:
That my problem www is not always the host when it is a sub-domain it
would be like mysit.domain.net or sometimes people put a few extra
periods in the domain name like www.my.test.net I thought maybe I
could look at the string and find out how many periods
this will remove the www plus the top level domain
?php
$site = 'www.somesite.home.com';
$site = str_replace('www.', '', $site);
$site = explode('.', $site);
$site = array_pop($site);
$site = implode('.', $site);
// somesite.home
?
this will remove the first host and the top level
I am trying to figure out how to pull data out of a string. This is
driving me crazy. I figure an if statement of some sort would work but
I'm not sure how to structure it.
I know how to get what I want if it is just
$fullhostname = www.domain.net;
$exp = explode(., $fullhostname);
$host =
Hello Philip,
Monday, May 14, 2001, 3:36:17 PM, you wrote:
That my problem www is not always the host when it is a sub-domain it
would be like mysit.domain.net or sometimes people put a few extra
periods in the domain name like www.my.test.net I thought maybe I
could look at the string and
4 matches
Mail list logo