Fonction PHP dns_get_record()
Exemple
Obtient les enregistrements de ressources MX associés à "www.w3schools.com":
<?php
print_r(dns_get_record("w3schools.com", DNS_MX));
?>
Définition et utilisation
La fonction dns_get_record() obtient les enregistrements de ressources DNS associés au nom d'hôte spécifié.
Syntaxe
dns_get_record(hostname, type, authns, addtl, raw)
Valeurs des paramètres
Parameter | Description |
---|---|
hostname | Required. Specifies a hostname (like "www.w3schools.com") |
type | Optional. Specifies the resource record type to search for. Can be one of the following:
|
authns | Optional. Passed by reference and, if set, it will be populated with Resource Records for the Authoritative Name Servers |
addtl | Optional. Passed by reference and, if set, it will be populated with any Additional Records |
raw | Optional. A Boolean value. If set to TRUE, it queries only the requested type instead of looping type-by-type before getting the info stuff. Default is FALSE |
Détails techniques
Valeur de retour : |
Un tableau de tableaux associatifs, FALSE en cas d'échec. Chaque tableau contient les clés suivantes (au minimum) :
Les autres clés des tableaux dépendent du paramètre de type . |
---|---|
Version PHP : | 5.0+ |
Journal des modifications PHP : | PHP 7.0.16 : Ajout de la prise en charge du type DNS_CAA . PHP 5.4 : Ajout du paramètre raw . PHP 5.3 : Disponible sur les plateformes Windows. |
❮ Référence réseau PHP