Forum Moderators: coopster
<?php
$ip = $_SERVER['REMOTE_ADDR'];
$fullhost = gethostbyaddr($ip);
$host = preg_replace("/^[^.]+./", "*.", $fullhost);
?>
i Want it to only output whats before the .ro,.com,.net,.org
For Example the fallowing Host names
to be Replaced by the Example i will give bellow them
customer7806.pool1.unallocated-106-128.orangehomedsl.co.uk
cpe-24-161-61-235.hvc.res.rr.com
79-113-108-166.rdsnet.ro
orangehomedsl.co.uk
hvc.res.rr.com
rdsnet.ro
in that case cpe-24-161-61-235.hvc.res.rr.com
becomes
rr.com ?
i Want it to only output whats before the .ro,.com,.net,.org
in that case cpe-24-161-61-235.hvc.res.rr.com
becomes
rr.com ?
bhukkel: Here You can find a list of all tld including for example .co.uk or .com
[publicsuffix.org...]
The wildcard character * (asterisk) matches any valid sequence of characters in a hostname part.