Dato un indirizzo internet (URL o URI) ecco come estrarne il dominio di appartenenza, in PHP:
// trova il nome del sito
$url="http://nome del sito...";
$mystring = substr($url, 7);
$pos = strpos($mystring, '/');
$sito = substr($mystring, 0, $pos);