Monday, March 25, 2013

Find your Internet Protocol (IP) Address and Remote Port using your self made PHP Script

Internet Protocol (IP) address is a unique key / number of your personal or your office computer. Most of the people who want to know their PC's / Laptop's IP Address, they directly go to IPChicken.com or any other IP Finding service. What if you create your own PHP Application which finds your PC's / Laptop's IP Address ?. In this post i'll show you few lines of PHP script which will help you to find your IP address and also it will find Remote Port.






PHP Code : To get the Internet Protocol Address. 

1.   $_SERVER["REMOTE_ADDR"];

That's the short code to find your IP address. Now, let's find our PCs or Laptops Remote Port. To find remote port we will again use the variable $_SERVER[]; but we will assign different value to it.

PHP Code : To get the Remote Port. 


1.   $_SERVER["REMOTE_PORT"];

Great! you also got the remote port. Now, simply print it using echo or using print. The preferred is to create a variable and then add the $_SERVER[]; variable.
Also, after making it share with your friends :P

What IP means : 
Every computer that communicates over the Internet is assigned an IP address that uniquely identifies the device and distinguishes it from other computers on the Internet. An IP address consists of four parts. For example : 59.182.17.16

What Remote Port Means : 
In TCP / IP networking ports are the endpoint to a logical connection. When you type in a website address your computer is opening up a connection on a remote port and asking for the web pages to be sent to your computer. There are 65535 ports.

Subscribe to my blog : 

6 comments:

  1. There are many methods and tutorials that teach you how to find an ip address,I use this tool http://www.ipgp.net/ to display information about any ip address, just enter any IP address into the box and you will get the country, city, region, ISP, street address and the satellite location map for every query.

    ReplyDelete
    Replies
    1. That's correct!, but many PHP learners won't try to find tutorials related to $_SERVER[]; only few of them tries, and especially most of the learners learn from w3school.com or tizag.com and these online learning resource won't provide little bit intermediate tutorials. That's the reason i shared this.

      Delete
  2. Nice information regarding ip address .

    ReplyDelete
  3. So Nice tutorial . I have learnt this tutorial .It's very helpful tutorial for find ip address . Really it's very good tutorial . It will very useful for all users.

    Thanks for sharing .

    ReplyDelete

Your Comment Will Be Visible After Approval, Thanks !