Quantcast
Channel: MondoUnix » PROGRAMMAZIONE
Viewing all articles
Browse latest Browse all 16

Php : convertire da hostname a indirizzo ip

$
0
0

Esempio :

<?php
$ip   = gethostbyname('www.mondounix.com');
$long = ip2long($ip);
 
if ($long == -1 || $long === FALSE) {
    echo 'Invalid IP, please try again';
} else {
    echo $ip   . "\n";           // 151.1.168.13
    echo $long . "\n";           // 2533468173
    printf("%u\n", ip2long($ip)); // 2533468173
}
?>

Viewing all articles
Browse latest Browse all 16

Latest Images

Trending Articles