I am using maxmind web service to get the user data:
Here is the PHP code to output the data.
Now here you can see I have commented out ip_address, user_type, is_anonymous, is_anonymous_proxy, is_anonymous_vpn, is_tor_exit_node key because I can’t get value using those keys?
can you tell me why?
$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'];
but If I do
print_r( $record );
I can see full object containing all the data.
Updated
Actual Object that is return https://codeshare.io/ad3nVy
Advertisement
Answer
you need to use the names as per these keys:
[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
)
So, basically for example:
$record->traits->ipAddress