Many times it is required to know the IP address of a visitor to our webpage. Among the different uses may be recording it to be able to ban a user or to personalize some web services. I will show you how to retrieve it using PHP.
You can know your IP address by creating a PHP file in your server with the following text in it:
There are other functions associated to the $_SERVER array like knowing the browser used to access your webpage. This can be useful to know which is the most used browser to surf your page and design it having it in mind to benefit the majority of your visitors (some webpages look quite different depending of the browser used). You can get a full table of the different functions $_SERVER has by creating a PHP file with the following code in it (remember to open it from your server, otherwise it won't work). If you run this file from your computer you will know everything about it and about your server.
Keep in mind that to use this you must have a server with PHP.
No comments:
Post a Comment