PHP Get Private and Public IP Address

Last modified: July 18, 2021
Private IP Address
<?php echo $_SERVER['REMOTE_ADDR']; ?>
Public IP Address
<?php $dyndns = file_get_contents('http://checkip.dyndns.com/'); $ipArray = explode(":", $dyndns); echo $ipArray[1]; ?>