0

このスクリプトで MaxMind GeoIP を使用しています。

$gi = geoip_open(RESSOURCE_PATH.'/MaxMind/tests/data/GeoIPCity.dat', GEOIP_STANDARD);

// $rsGeoData = GeoIP_record_by_addr($gi, $_SERVER['REMOTE_ADDR']);
$rsGeoData = GeoIP_record_by_addr($gi, '91.213.180.118');

echo("<pre>");
print_r($rsGeoData);
echo("</pre>");

geoip_close($gi);

ただし、$rsGeoData は常に null です (値が空の配列ではなく、実際には「null」、つまりis_null($rsGeoData)===null)。geoipcity.incファイルのこの関数によって Null が返されます。

function _get_record($gi, $ipnum)
{
    $seek_country = _geoip_seek_country($gi, $ipnum);
    if ($seek_country == $gi->databaseSegments) {
        return null;
    }
    return _common_get_record($gi, $seek_country);
}

理由が本当にわかりません...助けてもらえますか?

4

1 に答える 1