Thread: Domain Keyword
View Single Post
Old 11-25-2007, 12:59 AM   #1 (permalink)
Haris
The Frequenter
Prolific Welcomer Upcoming Programmer 
 
Join Date: Sep 2007
Posts: 360
Thanks: 24
Haris is on a distinguished road
Default Domain Keyword

I want to fetch the keyword from the domain.

Currently, my code works with www.domain.com but doesn't work with www.domain.co.uk and www.domain.com.uk or any domain that ends with two extensions.

PHP Code:
$szPattern '/^(http\:\/\/)?(www.)?(.*)\.(.*)$/'
Current Output with www.domain.com

Array ( [0] => http://www.domain.com [1] => http:// [2] => www. [3] => domain [4] => com )

Wrong output with www.domain.com.uk

Array ( [0] => http://www.domain.com.uk [1] => http:// [2] => www. [3] => domain.com [4] => uk )

The .com part should go with the other extension (uk) .
Haris is offline  
Reply With Quote