Like this for the server ip:
$_SERVER['SERVER_ADDR'];
and this for the port
$_SERVER['SERVER_PORT'];
More Related Contents:
- How to log IP address in text file
- IP addresses in PHP
- Getting the location from an IP address [closed]
- Getting visitors country from their IP
- How to get Real IP from Visitor? [duplicate]
- How to handle IPv6 Addresses in PHP?
- How to get MAC address of client using PHP?
- select outgoing ip for curl request
- IP address storing in MySQL database using PHP [duplicate]
- How to check an IP address is within a range of two IPs in PHP?
- How to get Time Zone through IP Address in PHP [duplicate]
- Getting list IPs from CIDR notation in PHP
- Get user’s current location
- How to use HTTP_X_FORWARDED_FOR properly?
- Get a user’s current location
- How do I get the external IP of my server using PHP?
- Regex to match an IP address [closed]
- remove white space before after of data in text area [duplicate]
- How to create login system in php? [closed]
- How Can I Remove “public/index.php” in the URL Generated Laravel?
- Change cart item prices in Woocommerce 3
- PHP: how can I get file creation date?
- PHP sessions default timeout [duplicate]
- How can I retrieve the full directory tree using SPL?
- Do I need to restart Apache after changing the php.ini file?
- Multiple javascript/css files: best practices?
- Separate space-delimited words in a string [duplicate]
- How can I get the last 7 characters of a PHP string?
- How to inject a repository into a service in Symfony?
- Moving array element to top in PHP