Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
// geot_user_country
// Return object of current user country details
$country = geot_user_country();
echo $country->name;
echo $country->isoCode;
//geot_country_code
// return current user country code
echo 'You country code is : ' . geot_country_code();
//geot_country_name
// return current user country name
echo 'You country name is : ' . geot_country_name();
//geot_country_by_ip
// Return country by given ip or current user if not ip is given
// $country->name $country->isoCode
$country = geot_country_by_ip("190.188.153.122");
echo 'Your country is : '. $country->name;
//geot_state_by_ip
// Return state by given ip or current user if not ip is given
// $state->name $state->isoCode
$state = geot_state_by_ip("190.188.153.122");
echo 'Your state is : '. $state->name;
//geot_city_name
// Return current user city name
echo 'Your city is: '. geot_city_name();
//geot_zip
// Return current user zip code
echo 'Your zip is: '. geot_zip();
//geot_time_zone
// Return current user time zone
echo 'Your time zone is: '. geot_time_zone();
//geot_radius
// Return current user radius
echo 'The accuracy radius is: '. geot_accuracy_radius();
//geot_lat
// Return current user lat
echo 'Your latitude is: '. geot_lat();
//geot_lng
// Return current user lng
echo 'Your longitude is: '. geot_lng();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment