Web Analytics
 Metode Load Halaman Pengunjunag Berdasakan IP

Metode Load Halaman Pengunjunag Berdasakan IP


//ambil IP

function get_client_ip_2()

{

 

$ipaddress = '';

 

if (isset($_SERVER['HTTP_CLIENT_IP']))

 

$ipaddress = $_SERVER['HTTP_CLIENT_IP'];

 

else if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))

 

$ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];

 

else if (isset($_SERVER['HTTP_X_FORWARDED']))

 

$ipaddress = $_SERVER['HTTP_X_FORWARDED'];

 

else if (isset($_SERVER['HTTP_FORWARDED_FOR']))

 

$ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];

 

else if (isset($_SERVER['HTTP_FORWARDED']))

 

$ipaddress = $_SERVER['HTTP_FORWARDED'];

 

else if (isset($_SERVER['REMOTE_ADDR']))

 

$ipaddress = $_SERVER['REMOTE_ADDR'];

 

else

 

$ipaddress = 'IP tidak dikenali';

 

return $ipaddress;

}

 

$ip_client = md5(get_client_ip_2());

 

//hitung kunjungan

$curl = curl_init();

curl_setopt_array($curl, array(

CURLOPT_URL => 'https://api.countapi.xyz/hit/namespace/' . $ip_client . '',

CURLOPT_RETURNTRANSFER => true,

CURLOPT_ENCODING => '',

CURLOPT_MAXREDIRS => 10,

CURLOPT_TIMEOUT => 0,

CURLOPT_FOLLOWLOCATION => true,

CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,

CURLOPT_CUSTOMREQUEST => 'GET',

));

 

$response = curl_exec($curl);

 

$json = json_decode($response);

$total = $json->value;

dd($total);

 

curl_close($curl);


Lanjut Part : 1
Jam : 18:21:42
Durasi Part : 0:0:1
Durasi Total : 0:0:1

Punya Pertanyaan , Silahkan Whatsapp Langsung
Muhammad Ullil Fahri
WA : 089696380422
Tautan WA : https://wa.me/message/SG4YA2XQP5FPE1
Theme Customizer

Theme Styles