i have a lot of urls ending with .com,.com.eu,.fr,.hk etc ..i need to filter the domains only end with .com and .fr ... using php....
+1
A:
You can use preg_match on each URL
preg_match('/(.*)\.(com|fr)$/', $domain, $tokens)
$tokens[1] will contain the domain name (and $tokens[2] will contain .fr or .com)
nico
2010-07-28 06:52:57
ya it worked for me thanks...
Raja
2010-07-28 07:16:47
A:
Split the string with "." character and choose the last element like
if(end(explode(".",$DOMAIN)) == "com")
DO_XYZ
Shubham
2010-07-28 06:53:26