Created
December 6, 2011 21:57
-
-
Save iveney/1440205 to your computer and use it in GitHub Desktop.
alfred extension for finding your ip location
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
<?php | |
$ip = $argv[1]; | |
$tags = get_meta_tags("http://www.geobytes.com/IpLocator.htm?GetLocation&template=php3.txt&IpAddress=$argv[1]"); | |
print "{$tags['city']}, {$tags['region']}, {$tags['country']}"; | |
?> |
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
#Desc: Find ip location | |
#Use: If not provided with IP, then find the current ip | |
IP="{query}" | |
if [ -z "$IP" ]; then | |
IP=$(curl --silent http://icanhazip.com) | |
fi | |
location=$(php -f ip_location.php -- $IP) | |
echo $IP | |
echo $location |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment