PHP - Funktion dns_get_record()
Beispiel
Ruft die mit „www.w3schools.com“ verknüpften MX-Ressourceneinträge ab:
<?php
print_r(dns_get_record("w3schools.com", DNS_MX));
?>
Definition und Verwendung
Die Funktion dns_get_record() ruft die DNS-Ressourceneinträge ab, die dem angegebenen Hostnamen zugeordnet sind.
Syntax
dns_get_record(hostname, type, authns, addtl, raw)
Parameterwerte
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 |
Technische Details
Rückgabewert: |
Ein Array von assoziativen Arrays, FALSE bei Fehler. Jedes Array enthält (mindestens) die folgenden Schlüssel:
Andere Schlüssel in den Arrays hängen vom Typparameter ab . |
---|---|
PHP-Version: | 5.0+ |
PHP-Änderungsprotokoll: | PHP 7.0.16: Unterstützung für DNS_CAA- Typ hinzugefügt . PHP 5.4: Raw -Parameter hinzugefügt. PHP 5.3: Verfügbar auf Windows-Plattformen. |
❮ PHP-Netzwerkreferenz