PHP- Check domain name from url

by barkkathulla 2014-03-14 18:05:12

Using PHP we can get domain name from given url...


$image_name="input url";
preg_match('@^(https?://)?([a-z0-9_-]+\.)*([a-z0-9_-]+)\.[a-z]{2,6}(/.*)?$@i',$image_name,$match);
$domain = $match[3];


This is very useful in blocked sites validation purpose....

Tagged in:

626
like
0
dislike
0
mail
flag

You must LOGIN to add comments