Skip to content

Instantly share code, notes, and snippets.

@vandanojan
Last active March 24, 2024 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vandanojan/2a8a64cba53e8bce885353c4529d54c8 to your computer and use it in GitHub Desktop.
Save vandanojan/2a8a64cba53e8bce885353c4529d54c8 to your computer and use it in GitHub Desktop.
Server's Real IP Address
<?php
$this_server_real_ip_address = "";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.ipify.org"); //or replace the URL with https://www.showmyip.com/
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$this_server_real_ip_address = curl_exec($ch);
curl_close($ch);
echo $this_server_real_ip_address;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment