You can use the regular expression
I think it may be helpful for you
$host= "www.networkstuff.co.nz";
preg_match('/^(w{3})\.([a-zA-Z]+)\.([a-zA-z]{2})\.([a-zA-z]{2})/', $host,
$matches);
$returnedString = $matches[3]
echo $returnedString;
Regards
Renjith
On Mon, Jan 26, 2009 at 9:20 PM, Michael <[email protected]> wrote:
>
> What I need to do is grab the TLD from a URL string-
>
> eg: www.networkstuff.co.nz - what I want returned is the 'nz' part.
>
> What is the best way to achieve this?
>
> Thanks in anticipation.
>
> Michael
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]
-~----------~----~----~----~------~----~------~--~---