geoip_asnum_by_name

(PECL geoip >= 1.1.0)

geoip_asnum_by_nameAS番号(ASN) を取得する

説明

geoip_asnum_by_name(string $hostname): string

geoip_asnum_by_name() 関数は、 IPアドレスに関連付けられたAS番号(ASN)を返します。

パラメータ

hostname

ホスト名またはIPアドレス

返り値

成功時にはAS番号を返します。 アドレスがデータベースに見つからなかった場合は false を返します。

例1 geoip_asnum_by_name() の例

この例は、www.example.com のAS番号を出力します。

<?php
$asn 
geoip_asnum_by_name('www.example.com');

if (
$asn) {
    echo 
'The ASN is: ' $asn;
}
?>

上の例の出力は以下となります。

The ASN is: AS15133 EdgeCast Networks, Inc

add a note add a note

User Contributed Notes 1 note

up
24
edwin at theroyalstudent dot com
9 years ago
The code example as stated has a missing '.', causing a syntax error if it is pasted and executed without being checked.

Correct Code:

<?php
$asn
= geoip_asnum_by_name('www.example.com');

if (
$asn) {
    echo
'The ASN is: ' . $asn;
}
?>
To Top