Skip to content

Instantly share code, notes, and snippets.

@timersys
Last active August 12, 2022 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timersys/b6dda85acb7ca19c67d24700977cf0f0 to your computer and use it in GitHub Desktop.
Save timersys/b6dda85acb7ca19c67d24700977cf0f0 to your computer and use it in GitHub Desktop.
<?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_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