I'm trying to obtain latitude and longitude using freegeoip from shell. When I try the following commands:
$ curl -s --get http://freegeoip.net/json/74.201.113.118 | grep -Po '(?<="latitude":)[^,}]*'
$ curl -s --get http://freegeoip.net/json/74.201.113.118 | grep -Po '(?<="longitude":)[^,}]*'
I'm able to obtain some values, but whenever I replace the ip adress with my own, the command just outputs 0. Any idea why?
The problem was using private ip. Since private ip is location independent, freegeoip.net retrieves nothing. Using public ip instead of private ip solves the problem.