Originally Posted by jtag
The lynx is working with "http://www.whatismyip.com/tools/ip-address-lookup.asp" but (maybe I was not clear) I would like to implement this in a bash script and to grep the location (Canada, USA ...).
The problem is that I have to enter the IP on the site and I don't know how to implement this in a script.
I'm not sure if whatismyip.com has shortcut URL to determine the location of an IP. I also tried with -dump, -post_data, -cmd_log, -cmd_script (read from lynx's man page) but not success.
An alternative way, I suggest you use ip2location which has shortcut URL, therefore you can find out the location of an IP address from command line:
$ lynx -dump --accept_all_cookies http://ip2location.com/22.214.171.124 | grep -A9 "IP Address Country Region City Latitude"
IP Address Country Region City Latitude/
Longitude ZIP Code Time Zone
126.96.36.199 [US.gif] UNITED STATES CALIFORNIA MOUNTAIN VIEW 37.3956
-122.076 94043 -08:00 Map It
Net Speed ISP Domain
DSL GOOGLE INCORPORATED GOOGLE.COM
IDD Code Area Code Weather Station
1 650 USCA0746 - MOUNTAIN VIEW