ajetrumpet Posted October 15, 2019 Share Posted October 15, 2019 (edited) i found the following code here: https://stackoverflow.com/questions/409999/getting-the-location-from-an-ip-address <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script> contry_code = google.loader.ClientLocation.address.country_code city = google.loader.ClientLocation.address.city region = google.loader.ClientLocation.address.region </script> will this work to get location info? Edited October 15, 2019 by ajetrumpet Quote Link to comment https://forums.phpfreaks.com/topic/309377-google-geolocation/ Share on other sites More sharing options...
Barand Posted October 15, 2019 Share Posted October 15, 2019 It will get location info, but not necessarily the correct info. For me, it returned Country : GB Region: West Riding of Yorkshire City : Salford. The country is correct. However I do not live in Salford or the West Riding of Yorkshire. Also, Salford is in Lancashire, not in the West Riding of Yorkshire. I'd class it as a "Failed". (Moved to new topic) Quote Link to comment https://forums.phpfreaks.com/topic/309377-google-geolocation/#findComment-1570702 Share on other sites More sharing options...
gw1500se Posted October 15, 2019 Share Posted October 15, 2019 IP address locations are based on the ISP location not the assigned user location. Quote Link to comment https://forums.phpfreaks.com/topic/309377-google-geolocation/#findComment-1570705 Share on other sites More sharing options...
ajetrumpet Posted October 15, 2019 Author Share Posted October 15, 2019 6 minutes ago, gw1500se said: IP address locations are based on the ISP location not the assigned user location. if that is the case, how would one capture the actual user's info? is this even possible? Quote Link to comment https://forums.phpfreaks.com/topic/309377-google-geolocation/#findComment-1570706 Share on other sites More sharing options...
gw1500se Posted October 15, 2019 Share Posted October 15, 2019 Not for DNS assigned IPs. Static IPs are only a maybe. There is no way to capture that reliably without user interaction. Quote Link to comment https://forums.phpfreaks.com/topic/309377-google-geolocation/#findComment-1570707 Share on other sites More sharing options...
ajetrumpet Posted October 15, 2019 Author Share Posted October 15, 2019 good to know. thanks brother. i will stick with the ip lookup website then. Quote Link to comment https://forums.phpfreaks.com/topic/309377-google-geolocation/#findComment-1570708 Share on other sites More sharing options...
Barand Posted October 15, 2019 Share Posted October 15, 2019 45 minutes ago, gw1500se said: IP address locations are based on the ISP location not the assigned user location. My results could be right then - there is the possibility that my ISP is in Salford. As for the region, it could be Google has a Londoner's view of England where anywhere beyond the end of their Northern underground line is "the North" (beware, here be dragons!) Quote Link to comment https://forums.phpfreaks.com/topic/309377-google-geolocation/#findComment-1570709 Share on other sites More sharing options...
requinix Posted October 15, 2019 Share Posted October 15, 2019 For the record, if you're dealing with mobile devices then you can get GPS information - if the user allows you to do so. Non-mobile devices will give you information according to the IP address (user still has to approve), which will be more or less the same as the geolocation version. Basically, geolocation is only as good as a country and state. City is hit or miss. Quote Link to comment https://forums.phpfreaks.com/topic/309377-google-geolocation/#findComment-1570712 Share on other sites More sharing options...
ajetrumpet Posted October 16, 2019 Author Share Posted October 16, 2019 the way i have it now, the president of this org. doesn't have to do anything but click on the link in the traffic report to see the ip geolocation information so it is fine the way it is. Quote Link to comment https://forums.phpfreaks.com/topic/309377-google-geolocation/#findComment-1570718 Share on other sites More sharing options...
ajetrumpet Posted October 16, 2019 Author Share Posted October 16, 2019 this is interesting...facebook shows that my geo location is 2 hours away from me! i'm on a wifi hotspot on my phone and my carrier is us cellular, so this too proves that this whole geo thing is not at all reliable. Quote Link to comment https://forums.phpfreaks.com/topic/309377-google-geolocation/#findComment-1570736 Share on other sites More sharing options...
Barand Posted October 16, 2019 Share Posted October 16, 2019 14 hours ago, ajetrumpet said: the president of this org. doesn't have to do anything but click on the link in the traffic report to see the ip geolocation information So you're writing an application for those in your company who don't know where they are when they are browsing reports? Quote Link to comment https://forums.phpfreaks.com/topic/309377-google-geolocation/#findComment-1570737 Share on other sites More sharing options...
ajetrumpet Posted October 16, 2019 Author Share Posted October 16, 2019 (edited) ??? why do you say that? my words indicate nothing of the sort. they want it as easy as possible. don't most small business people? they don't have time to figure that crap out, nor do they care to. Edited October 16, 2019 by ajetrumpet Quote Link to comment https://forums.phpfreaks.com/topic/309377-google-geolocation/#findComment-1570738 Share on other sites More sharing options...
Barand Posted October 16, 2019 Share Posted October 16, 2019 Wondering why he would want to click on a link to see where he is. Quote Link to comment https://forums.phpfreaks.com/topic/309377-google-geolocation/#findComment-1570739 Share on other sites More sharing options...
ajetrumpet Posted October 16, 2019 Author Share Posted October 16, 2019 he's not doing it for that purpose Barand. you should know, u gave me the correct script! he wants to know where his visitors are coming from. i regularly check that report and there are plenty of visits from google's cloud, google's bots, ms's bots and us cellular's company as well, which is our cell phone carrier. Quote Link to comment https://forums.phpfreaks.com/topic/309377-google-geolocation/#findComment-1570740 Share on other sites More sharing options...
ajetrumpet Posted October 16, 2019 Author Share Posted October 16, 2019 are you still running this consultancy? http://www.barringtondrew.co.uk/ Quote Link to comment https://forums.phpfreaks.com/topic/309377-google-geolocation/#findComment-1570741 Share on other sites More sharing options...
Barand Posted October 16, 2019 Share Posted October 16, 2019 10 minutes ago, ajetrumpet said: he wants to know where his visitors are coming from. I was thinking you were using city = google.loader.ClientLocation.address.city which just shows location of current user (or user's proxy) 10 minutes ago, ajetrumpet said: are you still running this consultancy? If anyone ever contacts it. It hasn't happened yet. I was thinking of contacting the Guiness Book of Records as the world's least visited site. Quote Link to comment https://forums.phpfreaks.com/topic/309377-google-geolocation/#findComment-1570742 Share on other sites More sharing options...
ajetrumpet Posted October 16, 2019 Author Share Posted October 16, 2019 (edited) lol, nice! you have yet to attract ONE customer!? you've never sold anything? i don't even have a website and i've done plenty of individual contracts! and you mite as well contact them. they have records for just about everything imaginable. Edited October 16, 2019 by ajetrumpet Quote Link to comment https://forums.phpfreaks.com/topic/309377-google-geolocation/#findComment-1570743 Share on other sites More sharing options...
Barand Posted October 16, 2019 Share Posted October 16, 2019 P.S. 18 minutes ago, ajetrumpet said: you should know, u gave me the correct script! If you are talking about correcting your href in the other thread then all I ever saw was a variable called $col. There was no way I could know what was in it. Quote Link to comment https://forums.phpfreaks.com/topic/309377-google-geolocation/#findComment-1570744 Share on other sites More sharing options...
Barand Posted October 16, 2019 Share Posted October 16, 2019 9 minutes ago, ajetrumpet said: and i've done plenty of individual contracts! Considering your lack of knowledge, please pass on my deepest sympathies to your clients. 1 Quote Link to comment https://forums.phpfreaks.com/topic/309377-google-geolocation/#findComment-1570745 Share on other sites More sharing options...
ajetrumpet Posted October 16, 2019 Author Share Posted October 16, 2019 lack of knowledge in PHP only, buddy boy. i never said i did contracts in PHP. Quote Link to comment https://forums.phpfreaks.com/topic/309377-google-geolocation/#findComment-1570746 Share on other sites More sharing options...
ajetrumpet Posted October 16, 2019 Author Share Posted October 16, 2019 oh and I just read in the news that some of the programming experts out there consider PHP to be a dying language, along with mainframers like cobol and fortran. I seriously doubt that though. Quote Link to comment https://forums.phpfreaks.com/topic/309377-google-geolocation/#findComment-1570747 Share on other sites More sharing options...
Barand Posted October 16, 2019 Share Posted October 16, 2019 45 minutes ago, ajetrumpet said: in PHP only HTML? JavaScript? CSS? I was referring to web languages in general and the interaction between them - you seem to have conned your current employer into believing you know what you're doing. 😉 Quote Link to comment https://forums.phpfreaks.com/topic/309377-google-geolocation/#findComment-1570751 Share on other sites More sharing options...
ajetrumpet Posted October 16, 2019 Author Share Posted October 16, 2019 actually no i didn't. i wasn't hired for PHP. nor was i hired for web application work. but microsoft technologies suck, so he asked me what was available in the open source world. small business people don't have a ton of money to spend while they are in the early stages of business, thus he asked if I would learn it to produce some small projects. and now I will develop a mobile app for the same guy. that will be a huge undertaking. i'm really not looking forward to it. Quote Link to comment https://forums.phpfreaks.com/topic/309377-google-geolocation/#findComment-1570753 Share on other sites More sharing options...
Barand Posted October 16, 2019 Share Posted October 16, 2019 In that case, my apologies. Quote Link to comment https://forums.phpfreaks.com/topic/309377-google-geolocation/#findComment-1570754 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.