Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 11th, 2007, 10:45 PM   #1
grimpirate
King of Portal
 
grimpirate's Avatar
 
Join Date: Sep 2005
Posts: 431
Rep Power: 4 grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
Geolocation through IPs

Before I start let me say that I have no idea how it is that latitude and longitude are determined from an IP address. I'm unsure if all methods use some sort of database, or if there's an actual way to determine the location based on the constituent numbers of the address. In any case, I found a website which allows you to type in an IP address and it provides the geographic data free of charge. So what I did was I used PHP to parse the content of this page into an array format and then store it in a database. Then another script turns it into a variable and passes the geographical information to a Flash file. Finally, this Flash file translates onto a globe the approximate positions of these regions. I just did this as a nifty little trick for tracking where people are accessing the main page of my software from. Thought someone might like to see it. Limitations: It only tracks the people that access the front page of my site, and it doesn't update dynamically. Sadly, the awardspace server won't allow me to use the PHP function file_get_contents() beyond the scope of the local URL. I'm forced to update the map's database files by hand.
__________________
Lo, there do I see my father. 'Lo, there do I see My mother, and my sisters, and my brothers. 'Lo, there do I see The line of my people... Back to the beginning. 'Lo, they do call to me. They bid me take my place among them. In the halls of Valhalla... Where the brave... May live... ...forever.. GrimBB | Mimesis
grimpirate is offline   Reply With Quote
Old Apr 11th, 2007, 11:18 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
It's strictly database, as there's no strict relation to lat/long. You can get DBs via a Google search. Nice implementation, though.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Apr 12th, 2007, 12:26 PM   #3
PhilBon
Hobbyist Programmer
 
PhilBon's Avatar
 
Join Date: Nov 2005
Posts: 172
Rep Power: 3 PhilBon is on a distinguished road
Send a message via AIM to PhilBon Send a message via MSN to PhilBon
What was the site that you got the long and lat points from? You might want to think about downloading a PHP Proxy and looking at the code that it uses to retrieve the website and adapt it for your site. If you are still needing to use the php function to access a site and can't do it, install PHP and MySQL onto a machine at home and run all the ip addresses through and have it load into the mysql database or have it be called by your current webserver and then have it return the long and lat points. If that makes any sense.
PhilBon is offline   Reply With Quote
Old Apr 12th, 2007, 1:15 PM   #4
grimpirate
King of Portal
 
grimpirate's Avatar
 
Join Date: Sep 2005
Posts: 431
Rep Power: 4 grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
Quote:
What was the site that you got the long and lat points from?
The site is http://www.geoiptool.com/
Quote:
You might want to think about downloading a PHP Proxy and looking at the code that it uses to retrieve the website and adapt it for your site.
No clue what you mean by a PHP Proxy.
Quote:
If you are still needing to use the php function to access a site and can't do it,
Any sort of data retrieval from sites beyond the actual awardspace server is not permissible I tried file/stream/socket anything I could think of and had no luck.
Quote:
install PHP and MySQL onto a machine at home and run all the ip addresses through and have it load into the mysql database or have it be called by your current webserver and then have it return the long and lat points. If that makes any sense.
When I stated that I update the database files by hand that's not exactly (I don't go into notepad and edit the files) what I meant. I'll explain it in a stepwise manner:
  1. My website logs all the ips to a file called visitors.txt
  2. I periodically download visitors.txt onto my home computer
  3. Using my local PHP setup I run a file called grimbbstats.php which takes the file visitors.txt breaks it into individual ips and then runs each ip through the site. Furthermore, it creates a series of database entries (not using MySQL but my own relational flat file database implementation) into a folder.
  4. The created database entries are then uploaded into a folder on my site.
  5. Finally, the map.swf file accesses the database by first accessing a file called locate.php which parses the database into latitude and longitude in a flash understandable way.
  6. You see the map with its little green dots.
So the only limitation is the lack of being able to access foreign sites from my server. I could probably do this with javascript, buuuuuuut I don't like javascript. I like all my sites to function without the need for javascript. Reinventing wheels is fun dur dur. Ahh you can only enjoy DaWei's praise for so long before you burn yourself out. You flew too close to the sun Grim! My wax scripts are melting, melting!
__________________
Lo, there do I see my father. 'Lo, there do I see My mother, and my sisters, and my brothers. 'Lo, there do I see The line of my people... Back to the beginning. 'Lo, they do call to me. They bid me take my place among them. In the halls of Valhalla... Where the brave... May live... ...forever.. GrimBB | Mimesis
grimpirate is offline   Reply With Quote
Old Apr 12th, 2007, 6:20 PM   #5
PhilBon
Hobbyist Programmer
 
PhilBon's Avatar
 
Join Date: Nov 2005
Posts: 172
Rep Power: 3 PhilBon is on a distinguished road
Send a message via AIM to PhilBon Send a message via MSN to PhilBon
a PHP Proxy, is a web based proxy: http://www.phproxy.org/ to where it's coded in php. Then again it sounds like you've already done something like it. You could probably automate that whole process that you use:
Quote:
1. My website logs all the ips to a file called visitors.txt
2. I periodically download visitors.txt onto my home computer
3. Using my local PHP setup I run a file called grimbbstats.php which takes the file visitors.txt breaks it into individual ips and then runs each ip through the site. Furthermore, it creates a series of database entries (not using MySQL but my own relational flat file database implementation) into a folder.
4. The created database entries are then uploaded into a folder on my site.
5. Finally, the map.swf file accesses the database by first accessing a file called locate.php which parses the database into latitude and longitude in a flash understandable way.
6. You see the map with its little green dots.
That's only if you don't want to deal with all that uploading and downloading.
PhilBon is offline   Reply With Quote
Old Apr 12th, 2007, 11:39 PM   #6
physicist
Hobbyist Programmer
 
Join Date: Oct 2006
Posts: 146
Rep Power: 2 physicist is on a distinguished road
well it says im in pennsylvania, LOL im not even close really...
physicist is offline   Reply With Quote
Old Apr 13th, 2007, 12:06 AM   #7
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
I suppose it is where your IP is registered... not necessarily your physical location.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Apr 13th, 2007, 1:17 AM   #8
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Yup. Mine shows about 100 miles southeast. My site's server is in Toronto, but its IP shows in Calgary. That's quite a fur piece.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:39 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC