我正在使用maxmind web服务来获取用户数据:
以下是用于输出数据的PHP代码。
现在,您可以看到我已经注释掉了Ip_address、user_type、is_anonymous、is_annymous_proxy、is_anonemous_vpn、is_tor_exit_node键,因为我无法使用这些键获取值?
你能告诉我为什么吗?
$client = new Client( client number , 'my license keyu');
// Call insights method to get full details
$record = $client->insights( '103.82.11.26' );
//$result['ipAddress'] = $record->traits->ip_address;
$result['country'] = $record->country->name;
$result['city'] = $record->city->name;
//$result['userType'] = $record->traits->user_type;
$result['isp'] = $record->traits->isp;
$result['organization'] = $record->traits->organization;
$result['network'] = $record->traits->network;
//$result['isAanonymous'] = $record->traits->is_anonymous;
//$result['isAnonymous_proxy'] = $record->traits->is_anonymous_proxy;
//$result['isAnonymous_vpn'] = $record->traits->is_anonymous_vpn;
//$result['isTorExitNode'] = $record->traits->is_tor_exit_node;
$result['referer'] = $_SERVER['HTTP_REFERER'];
$result['userAgent'] = $_SERVER['HTTP_USER_AGENT'];
但是如果我做
print_r( $record );
我可以看到包含所有数据的完整对象。
更新
返回的实际对象https://codeshare.io/ad3nVy
您需要按照以下键使用名称:
[0] => autonomousSystemNumber
[1] => autonomousSystemOrganization
[2] => connectionType
[3] => domain
[4] => ipAddress
[5] => isAnonymous
[6] => isAnonymousProxy
[7] => isAnonymousVpn
[8] => isHostingProvider
[9] => isLegitimateProxy
[10] => isp
[11] => isPublicProxy
[12] => isSatelliteProvider
[13] => isTorExitNode
[14] => network
[15] => organization
[16] => staticIpScore
[17] => userCount
[18] => userType
)
因此,基本上例如:
$record->性状>ipAddress