<?php $host=gethostbyaddr($_SERVER['REMOTE_ADDR']); $patt='/\.(?P<host>[a-z]+)/'; preg_match($patt,$host,$matches); print_r($matches["host"]); ?>