PHP dns_get_record()関数
例
「www.w3schools.com」に関連付けられているMXリソースレコードを取得します。
<?php
print_r(dns_get_record("w3schools.com", DNS_MX));
?>
定義と使用法
dns_get_record()関数は、指定されたホスト名に関連付けられたDNSリソースレコードを取得します。
構文
dns_get_record(hostname, type, authns, addtl, raw)
パラメータ値
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 |
技術的な詳細
戻り値: |
連想配列の配列。失敗するとFALSE。各アレイには、(少なくとも)次のキーが含まれています。
配列内の他のキーは、typeパラメーターによって異なります。 |
---|---|
PHPバージョン: | 5.0以降 |
PHP変更ログ: | PHP 7.0.16:DNS_CAAタイプのサポートが追加されました。 PHP 5.4: rawパラメーターを追加しました。 PHP 5.3:Windowsプラットフォームで利用できます。 |
❮PHPネットワークリファレンス