How can I identify the server IP address in PHP?
This is what you could use as an adaptation of the above examples without worrying about curl installed on your server.