User Control Panel
Advertisements

HELP US, HELP YOU!

IP info & Google maps locator

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Services
View unanswered posts
Author Message
Teario
Member
Member


Joined: 25 Jun 2004
Posts: 126
Location: Liverpool(home) or Derby(uni), UK
Reputation: 58
votes: 3

PostPosted: Thu Jun 01, 2006 2:31 pm    Post subject: IP info & Google maps locator Reply with quote

I am really offering two seperate services that should be used in conjunction, but could be used seperately if desired.

Before I begin, I would first like to say that this is running on a home server, so I cannot guarantee its stability. If anyone would be so kind as to offer some of their own, more stable server space for this, then it would be much apreciated. The files to run this service are attatched.

If you do wish to run this service yourself, then you will need an api key from google: http://www.google.com/apis/maps/signup.html

OK on to the service:

The first, located at http://beastserver.hopto.org/~teario/google/locate/?ip= will take an ip address and attempt to retrieve the following information:
City name
Country name
Country abbreviation
Latitude
Longitude

You can test it using bot-depots IP here: http://beastserver.hopto.org/~teario/google/locate/?ip=209.59.181.137
Returned should be something like:
Quote:
Wilbur, WA
UNITED STATES
US
47.7581
-118.705


Taking the lat and long from those results, we can use the second service, which is a google maps api that takes the lat and long as parameters, and is located here: http://beastserver.hopto.org/~teario/google/locate/locinfo?lat=47.7581&lng=-118.705

The command I use for my bot is the following:
Code:
my( $self, $params, $email, $name, %style ) = @_;

   my @ipinfo = split( "\n", LWP::Simple::get( 'http://beastserver.hopto.org/~teario/google/locate/?ip='.$params ) );

   if( scalar( @ipinfo ) > 1 )
   {
      $info = "City: ".$ipinfo[0]."\n".
         "Country: ".$ipinfo[1]."\n".
         "Country abbrev: ".$ipinfo[2]."\n";

      if( $ipinfo[3] )
      {
         $info .= "Latitude: ".$ipinfo[3]."\n".
             "Longitude: ".$ipinfo[4]."\n".
             "Map: ".'http://beastserver.hopto.org/~teario/google/locate/locinfo.php?lat='.$ipinfo[3].'&lng='.$ipinfo[4];
      }
   }
   else
   {
      $info = $ipinfo[0];
   }

   $self->sendMessage( $info, %style );


Not all IPs can be located. The website used to retrieve the information seems to cover most of america, but not many other countries. Also since another site is used to locate the IPs, I cannot guarantee their accuracy, however most of the examples I tried (not posted) seem to be pretty good.

Some example results using my bot:

Quote:

(example trying to locate bot-depot)
[Teario] says (14:4Cool:
!ipinfo 127.0.0.1
[Crybot] says (14:4Cool:
City: Wilbur, WA
Country: UNITED STATES
Country abbrev: US
Latitude: 47.7581
Longitude: -118.705
Map: http://beastserver.hopto.org/~teario/google/locate/locinfo.php?lat=47.7581&lng=-118.705

(example of an un-locatable [or in this case, impossible] IP)
[Teario] says (14:50):
!ipinfo 209.59.555.555
[Crybot] says (14:50):
Unable to locate the given IP

(locating my own IP [which i have removed from the quote] it could not find my city, so no co-ordinates were given)
[Teario]says (14:53):
!ipinfo myip.myip.myip.myip
[Crybot] says (14:53):
City: (Unknown city)
Country: UNITED KINGDOM
Country abbrev: UK

(example of *** as IP (aparently a private address))
[Teario] says (14:53):
!ipinfo ***.***.***.***
[Crybot] says (14:53):
City: (Private Address)
Country: (Private Address)
Country abbrev: XX

(example of no ip address provided)
[Teario] says (14:54):
!ipinfo
[Crybot] says (14:54):
City: (Unknown City?)
Country: (Unknown Country?)
Country abbrev: XX


Well that is pretty much it. I hope you enjoy using the service and put it to good use Smile

remember: the files are attatched if you would like to offer to run this service, or also if youre just interested in seeing how I put it together (and maybe improving my code? Smile ) Cool

edit: I have just found another service which is very similar to this: http://www.bot-depot.com/viewtopic.php?t=5133


Last edited by Teario on Fri Mar 09, 2007 2:39 pm; edited 2 times in total
Back to top
patrick
Newbie
Newbie


Joined: 17 Apr 2006
Posts: 42
Location: Arnhem, the Netherlands
Reputation: 5.3Reputation: 5.3Reputation: 5.3Reputation: 5.3Reputation: 5.3
votes: 1

PostPosted: Thu Jun 01, 2006 6:10 pm    Post subject: Reply with quote

It's great Very Happy

I host te file on my web server. Very Happy.(they could move to a other location)

My server can be used for testing if you don't have a web server.

(www.stroef.nl/mike/benodigheden/index.php?ip=)
Back to top
jeffohrt
Newbie
Newbie


Joined: 08 May 2006
Posts: 17

Reputation: 6Reputation: 6Reputation: 6Reputation: 6Reputation: 6Reputation: 6

PostPosted: Fri Jun 02, 2006 12:42 am    Post subject: clustrmaps.com Reply with quote

You could pull off a neat clustrmaps mimic if you could work in the GUI ...

Whoops - forgot - http://www.clustrmaps.com
Back to top
tompoes
Newbie
Newbie


Joined: 30 Jun 2006
Posts: 7

Reputation: 8.3Reputation: 8.3Reputation: 8.3Reputation: 8.3Reputation: 8.3Reputation: 8.3Reputation: 8.3Reputation: 8.3

PostPosted: Thu Mar 08, 2007 9:28 am    Post subject: Reply with quote

Is there also a possibility to view this info without a bot? I mean: I would like to enter the webpage as a visitor and see the IP info on the map.
Back to top
Teario
Member
Member


Joined: 25 Jun 2004
Posts: 126
Location: Liverpool(home) or Derby(uni), UK
Reputation: 58
votes: 3

PostPosted: Thu Mar 08, 2007 11:59 am    Post subject: Reply with quote

There is a way you can do it. In PHP you can get the ip address of the visitor to the site by using $_SERVER['REMOTE_ADDR']

Then you can use other services to locate the ip address for you, and give you the latitude and longitude. After that you just have to show a map. If you use the google maps api, then you can create a new marker at the co-ordinates you got from locating the ip.

Im pretty sure the above script gets the ip from the pages html code. There are probably services out there that will format them in a way much easier to use so search around first.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Services All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group