What potential issues or limitations should be considered when trying to access the WAN-IP address of a server using PHP?

One potential issue when trying to access the WAN-IP address of a server using PHP is that the server may be behind a NAT (Network Address Translation) firewall, making it difficult to determine the actual WAN-IP address. One way to solve this issue is by using an external service that can provide the WAN-IP address. Another limitation is that some hosting providers may restrict access to the WAN-IP address for security reasons.

// Use an external service to get the WAN-IP address
$wanIp = file_get_contents('https://api.ipify.org');
echo $wanIp;