Jump to content

Recommended Posts

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 ....

Link to comment
https://forums.phpfreaks.com/topic/263040-how-to-detect-which-ip-is-hit-using-php/
Share on other sites

$_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.

 

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

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.