Reputation: 44413
hey guys, i wonder how difficult it is (and what programming languages i need) to retrieve a users ip-adress and based on it's location i show a different ad on my website.
do you know any tutorials or can you tell what i have to search for to find a answer to that.
regards matt
Upvotes: 0
Views: 309
Reputation: 19837
The IP is usually very easy to retrieve in virtually any HTTP server environment. How to do so depends on the language and environment, but it's usually only a line of code. Be aware that if the user is running through a proxy or VPN, you won't be able to get their true IP, but only that of the proxy.
To determine the physical location, you'll need to use an IP Geolocation service. There are some free ones, but the paid ones are usually more accurate.
Upvotes: 1