无法从 maxmind return 对象获取键值
Can not get key value from maxmind return object
我正在使用 maxmind 网络服务获取用户数据:
这里是PHP输出数据的代码。
现在你可以看到我已经注释掉了ip_address, user_type, is_anonymous, is_anonymous_proxy, is_anonymous _vpn, is_tor_exit_node key 因为 我无法使用这些密钥获取值?
你能告诉我为什么吗?
$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 );
我可以看到包含所有数据的完整对象。
已更新
实际对象 return 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->traits->ipAddress
我正在使用 maxmind 网络服务获取用户数据:
这里是PHP输出数据的代码。
现在你可以看到我已经注释掉了ip_address, user_type, is_anonymous, is_anonymous_proxy, is_anonymous _vpn, is_tor_exit_node key 因为 我无法使用这些密钥获取值?
你能告诉我为什么吗?
$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 );
我可以看到包含所有数据的完整对象。
已更新
实际对象 return 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->traits->ipAddress