<?php $host = "http://site.ru/123.php"; preg_match("/^(http:\/\/?[^\/]+)/i",$host,$a); print_r ($a[1]); ?>