You might have seen some of the sites showing you the information like “Your IP address is 127.0.0.1 ” or “You are using Firefox browser” etc. Its really easy to display or get these user or visitor information using PHP codes. Here in this post, we will write a simple php code for displaying a visitor’s IP address, browser info and where that user came from (Http_Referrer i.e from which url the user clicked to get to your current page). This will be useful for you to keep track of your visitors or optimize the webpage for your users in a specific way depending on the browser or ip address etc.
PHP Code Output
Visitor IP address:
Browser (User Agent) Info:
Mozilla/5.0 (Windows NT 6.1; rv:9.0.1) Gecko/20100101 Firefox/9.0.1
Its really a simple PHP code, but still useful for you to track your website visitors and provide a better web browsing experience for them.