peace_Y Posted May 24, 2012 Share Posted May 24, 2012 I have some problems in my website. My website has 2 IPs, one is for local and another one for the broadcast. And I use googlemap as one of features in my website. The problem is, I only use API key for local IP, so if a user from outside of my local network accessed the web, the googlemp feature will not appear to them (because I only use API key for local IP). Are there anyone here who can help me how to detect which IP is used by the user, using PHP? Well my first idea is I will apply for another API and then when the script read which IP is hit then it will direct it to the right API key. Thanks before .... Quote Link to comment https://forums.phpfreaks.com/topic/263040-how-to-detect-which-ip-is-hit-using-php/ Share on other sites More sharing options...
kicken Posted May 24, 2012 Share Posted May 24, 2012 $_SERVER['HTTP_HOST'] will contain the hostname they used to connect, which will be the IP if you are doing something like http://12.34.56.78/ rather than connecting to a domain name. If you are using a domain name and just have the dns return different IP's then you should apply for your api key using the domain name, not the IP. Quote Link to comment https://forums.phpfreaks.com/topic/263040-how-to-detect-which-ip-is-hit-using-php/#findComment-1348235 Share on other sites More sharing options...
peace_Y Posted May 25, 2012 Author Share Posted May 25, 2012 First, thank you very much for your quick response. Well I dont have domain name, all IPs are in number one is like 192.000 and another one 202.000 so how to resolve this kind of IPs? Could you please write down the script ? Thank you before Quote Link to comment https://forums.phpfreaks.com/topic/263040-how-to-detect-which-ip-is-hit-using-php/#findComment-1348497 Share on other sites More sharing options...
Pikachu2000 Posted May 25, 2012 Share Posted May 25, 2012 This isn't a place to get scripts written for you free of charge. It's a place to get help with problems in code you're already written. If you want to hire someone to write a script, post in the freelance section. Quote Link to comment https://forums.phpfreaks.com/topic/263040-how-to-detect-which-ip-is-hit-using-php/#findComment-1348569 Share on other sites More sharing options...
peace_Y Posted May 28, 2012 Author Share Posted May 28, 2012 I'm sorry for my mistake ... I'm just dying to know how to do it. And my skill is zero. :'( Once again I'm sorry. NB : Mods ... you can close my thread. Thank you before Quote Link to comment https://forums.phpfreaks.com/topic/263040-how-to-detect-which-ip-is-hit-using-php/#findComment-1349098 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.