The Little Guy Posted March 31, 2010 Share Posted March 31, 2010 Is there a way for me to get the users current zip code of where they are with their laptop, or desktop? So, say I am in a Starbucks in the zip code: 12345 When you go to my site and do a search for surrounding areas, it would automatically fill the zip code box with 12345 How can this be done? Quote Link to comment https://forums.phpfreaks.com/topic/197136-get-zipcode/ Share on other sites More sharing options...
JonnoTheDev Posted March 31, 2010 Share Posted March 31, 2010 I think this would have to be some kind of GPS like apps you see on mobile phones / sat nav. You cannot get this through WIFI as this is essentially just a wireless router. Quote Link to comment https://forums.phpfreaks.com/topic/197136-get-zipcode/#findComment-1034939 Share on other sites More sharing options...
Philip Posted March 31, 2010 Share Posted March 31, 2010 Or you could do it via GeoIP - although not 100% accurate. http://pecl.php.net/package/geoip Quote Link to comment https://forums.phpfreaks.com/topic/197136-get-zipcode/#findComment-1034959 Share on other sites More sharing options...
JonnoTheDev Posted March 31, 2010 Share Posted March 31, 2010 The IP provided by the ISP will not be your curent location. In fact my IP locates to London UK which is over 200 miles away. So, this is not a viable solution to the question. Quote Link to comment https://forums.phpfreaks.com/topic/197136-get-zipcode/#findComment-1034986 Share on other sites More sharing options...
oni-kun Posted March 31, 2010 Share Posted March 31, 2010 The IP provided by the ISP will not be your curent location. In fact my IP locates to London UK which is over 200 miles away. So, this is not a viable solution to the question. Yes it is, as it is the only possible method to automatically detect the zip code. As areas other than UK seldom have frame servers more than ~2-20Mi away, then the Zip code should be within a fair accuracy, if not completely correct. Quote Link to comment https://forums.phpfreaks.com/topic/197136-get-zipcode/#findComment-1034989 Share on other sites More sharing options...
JonnoTheDev Posted March 31, 2010 Share Posted March 31, 2010 Then maybe it will work for you Quote Link to comment https://forums.phpfreaks.com/topic/197136-get-zipcode/#findComment-1034991 Share on other sites More sharing options...
Zane Posted March 31, 2010 Share Posted March 31, 2010 Yes it is, as it is the only possible method to automatically detect the zip code. As areas other than UK seldom have frame servers more than ~2-20Mi away, then the Zip code should be within a fair accuracy, if not completely correct. True, it'll give you a fair .. and probably accurate position to begin a radial search from, but that's just it.. you would have to perform a radial search from that point, get all the zipcodes within X miles (in which X is unknown).. and guess logically (somehow) from the responses. That's pretty much.. a "half-assed" accurate. And something half-assed is never something to rely on. Quote Link to comment https://forums.phpfreaks.com/topic/197136-get-zipcode/#findComment-1034995 Share on other sites More sharing options...
Philip Posted March 31, 2010 Share Posted March 31, 2010 Yeah, like I said not 100% accurate. It shows my location about 15miles away from where I actually am. Best thing is to guess where they are and have like "Results near City. Located elsewhere here? Enter your zip: [ ] " Quote Link to comment https://forums.phpfreaks.com/topic/197136-get-zipcode/#findComment-1035002 Share on other sites More sharing options...
JonnoTheDev Posted March 31, 2010 Share Posted March 31, 2010 You see this thing used all the time on like cheap ass dating sites in the uk. It'll say things like 'meet the perfect girl in Bristol'. I'm no where fuc**** near Bristol for god sake, and not that I use dating sites, just had to make a few for clients. Quote Link to comment https://forums.phpfreaks.com/topic/197136-get-zipcode/#findComment-1035006 Share on other sites More sharing options...
Zane Posted April 1, 2010 Share Posted April 1, 2010 Surprisingly, this place is pretty accurate http://www.hostip.info/ Off by about 10-20 miles Quote Link to comment https://forums.phpfreaks.com/topic/197136-get-zipcode/#findComment-1035054 Share on other sites More sharing options...
The Little Guy Posted April 1, 2010 Author Share Posted April 1, 2010 I see sites that say meet girls in Rosemount, MN. That is 100% accurate for me... How do they know I live in Rosemount? Quote Link to comment https://forums.phpfreaks.com/topic/197136-get-zipcode/#findComment-1035055 Share on other sites More sharing options...
The Little Guy Posted April 1, 2010 Author Share Posted April 1, 2010 Surprisingly, this place is pretty accurate http://www.hostip.info/ Off by about 10-20 miles Location: ... actually we haven't a clue. I found this: http://www.maxmind.com/app/locate_demo_ip and here is the dl page: http://www.maxmind.com/app/geoip_country Quote Link to comment https://forums.phpfreaks.com/topic/197136-get-zipcode/#findComment-1035056 Share on other sites More sharing options...
oni-kun Posted April 1, 2010 Share Posted April 1, 2010 If you want a recordset and not a poor calculation based off of where a last user was seen with the IP, then something such as Maxmind GeoIP's pro database will provide something like, 97-99.7% accuracy? But their free one (along with a few other GeoIP services) should be sufficient enough, there's no need for such a strong solution to replace what a user should do. The "Find at date at xxx" thing is ironically funny, first time I saw it, it was like "Oh, clever!" But then again maybe people would be willing to visit ONE city over for.... Well, lets leave it at there Quote Link to comment https://forums.phpfreaks.com/topic/197136-get-zipcode/#findComment-1035058 Share on other sites More sharing options...
The Little Guy Posted April 2, 2010 Author Share Posted April 2, 2010 OK... I have downloaded 2 cvs files, now I need to upload them to my mysql database.... anyone know how I can do that? phpMyAdmin only supports files that are <= 2MB, and I don't think cvs is even supported... Quote Link to comment https://forums.phpfreaks.com/topic/197136-get-zipcode/#findComment-1035924 Share on other sites More sharing options...
Daniel0 Posted April 2, 2010 Share Posted April 2, 2010 Can't you just parse it yourself then? CSV files are trivial to parse. In fact, see the fgetcsv function. Quote Link to comment https://forums.phpfreaks.com/topic/197136-get-zipcode/#findComment-1035945 Share on other sites More sharing options...
Zane Posted April 3, 2010 Share Posted April 3, 2010 There are some good sources of zip code databases here http://www.phpfreaks.com/forums/index.php/topic,208965.0.html No need to start from a CSV Quote Link to comment https://forums.phpfreaks.com/topic/197136-get-zipcode/#findComment-1036597 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.