PHP Get Destination Port For Website Visitors

Viewed 22

I Want To get Get destination port For my Visitors like wireshark i used to use $_SERVER['REMOTE_PORT']; , but i found this is not destination port cuz i tried on my self by using wireshark for example wireshark gives port ( in destination port field ) and my REMOTE_PORT gives another one on the same sec so is there any method to get Destination port like wireshark by using php ?

1 Answers

The destination port of any request coming to your site from visitors will be whatever port your webserver accepts HTTP requests on.

Usually that's 80 by default (or 443 for HTTPS), but it can be changed. You don't need a tool to detect this - either look at the URL (a request to anything other than the default will include the port number in the URL) or check your webserver settings.

Related