Files
2023_WEBSITE_jipf/plug/map_prof/utils/mp_get_ip.php

19 lines
523 B
PHP

<?php
function mp_get_ip() {
$external_ip = "";
// curl with php :
// https://www.php.net/manual/en/function.curl-init.php
$ch = curl_init('https://ifconfig.me/ip');
// CURLOPT_RETURNTRANSFER is set to true, which means that cURL should return the response from the HTTP request as a string, rather than printing it to the screen
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$external_ip = curl_exec($ch);
//mp_console_log("ip:");
//mp_console_log($external_ip);
curl_close($ch);
return $external_ip;
}
?>