PHP gethostbyname()
La fonction gethostbyname() est une fonction intégrée en PHP qui renvoie l’adresse IPv4 pour un nom de domaine donné.
Syntaxe
gethostbyname(hostname)
Paramètres
- hostname(Obligatoire) : Spécifie un nom d’hôte (comme « www.waytolearnx.com »).
Valeur de retour
La fonction renvoie l’adresse IPv4 en cas de succès. Le nom d’hôte en cas d’échec.
Version PHP:
4+
Exemple :
<?php $ip = gethostbyname("www.waytolearnx.com"); echo $ip; ?>