How can I get the IP address and port of a client with PHP? -
how ip , port of client php?
i tried script below gives me ip address.
<?php print $_server['remote_addr']; ?>
port defined in http server (apache or other , 80 or 443)
the php $_server variables can check @ : http://www.php.net/manual/en/reserved.variables.server.php
i sure : remote_addr' ip address user viewing current page.
but if server behind nat:
if serving behind proxy server, save time looking @ these $_server variables on machine behind proxy.
$_server['http_x_forwarded_for'] in place of $_server['remote_addr']
$_server['http_x_forwarded_host'] , $_server['http_x_forwarded_server'] in place of $_server['server_name']
:-)
Comments
Post a Comment