Skip to content

Instantly share code, notes, and snippets.

@mrizwan47
Created March 28, 2022 10:19
Show Gist options
  • Save mrizwan47/1634f0b921f0ced7634cde623f44ca8b to your computer and use it in GitHub Desktop.
Save mrizwan47/1634f0b921f0ced7634cde623f44ca8b to your computer and use it in GitHub Desktop.
PHP - Get google uule by location name
// Following the direction from https://moz.com/blog/geolocation-the-ultimate-tip-to-emulate-local-search
function convert_uule( $location_name )
{
// Code for length that resets at 64
$len = strlen($location_name) % 64;
// uule mapping array
$uule_map = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
// uule generation
return 'w+CAIQICI' . substr($uule_map, $len, 1) . base64_encode( $location_name );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment