Page 1 of 1

How to use the api in a dos style batch file

PostPosted: Sat May 19, 2007 10:59 am
by markrecob
What I ultimately want to do is run the batch file on a text file of IP addresses and look them all up for hostname and location. I have the hostname part working and am looking for a solution to the location. I found this batch code on some site but have been unable to make it work.
@echo off
set Name:=
set Address:=
for /f "tokens=1,2" %%A in ('nslookup %1') do set %%A=%%B
echo %Name:% %Address:%
echo get /api/get.html?ip=%Address:% | nc 80

I installed netcat so nc is working fine. I have experimented with many variations of the "echo get /api/get.html?ip=%Address:% | nc 80" line since it appears different from the examples on the site ("echo get /api/get_html.php?ip=%Address:% | nc 80" for instance. Nothing works. nc opens the port but it doesnt seem to pass the parameters so after a minute it just times out. Can anyone help? Thank you.