I’ve built a basic IP lookup service, similar to IPEcho.net. I used IPEcho in my May 8 post, Get & Store Your Server’s IP Address With PHP. I build on the service by providing other information in friendly JSON format. In addition to your IP, you can access the following programmatically via a structured object:
- Hostname. If you are querying the service from a host with a public hostname (via reverse DNS). This will not apply to most clients.
- Source / Remote Port. This is not the common port / well-known port used to access the site (called the destination port) — that would be port 80, the port you may know is used for HTTP traffic. Source Port is best described by this Stack Overflow post.
- User Agent. The browser details from the HTTP header sent to the server my the client / requesting machine.
- Referrer. The referring page.
The service provides JSON and plain text output. I’ve also included code samples from several languages so you can copy and paste right into your utility script. I’m running the service on AWS and expect it to be as reliable as AWS is.