Last active
March 24, 2024 15:44
-
-
Save vandanojan/2a8a64cba53e8bce885353c4529d54c8 to your computer and use it in GitHub Desktop.
Server's Real IP Address
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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