Created
March 28, 2022 10:19
-
-
Save mrizwan47/1634f0b921f0ced7634cde623f44ca8b to your computer and use it in GitHub Desktop.
PHP - Get google uule by location name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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