“Cara Mendapatkan Alamat IP PC di PHP” Kode Jawaban

Cara Mendapatkan Alamat IP Klien Menggunakan PHP

The simplest way to collect the Client/Visitor IP address using PHP is the REMOTE_ADDR.
Pass the 'REMOTE_ADDR' in PHP $_SERVER variable. It will return the IP address of the visitor who is currently viewing the webpage.

Get the IP address of the website
<?php
echo 'User IP Address : '. $_SERVER['REMOTE_ADDR'];
?>
  
/*
I Hope it will help you.
Namaste
Stay Home Stay Safe
*/
Ankur

PHP Dapatkan Alamat IP

$clientIPAddress=$_SERVER['REMOTE_ADDR']; 
Grepper

Cara Mendapatkan Alamat IP PC di PHP

function get_client_ip() {
  $ipaddress = '';
  if (getenv('HTTP_CLIENT_IP'))
    $ipaddress = getenv('HTTP_CLIENT_IP');

  else if(getenv('HTTP_X_FORWARDED_FOR'))
    $ipaddress = getenv('HTTP_X_FORWARDED_FOR');

  else if(getenv('HTTP_X_FORWARDED'))
    $ipaddress = getenv('HTTP_X_FORWARDED');

  else if(getenv('HTTP_FORWARDED_FOR'))
    $ipaddress = getenv('HTTP_FORWARDED_FOR');

  else if(getenv('HTTP_FORWARDED'))
    $ipaddress = getenv('HTTP_FORWARDED');

  else if(getenv('REMOTE_ADDR'))
    $ipaddress = getenv('REMOTE_ADDR');

  else
    $ipaddress = 'UNKNOWN';

  return $ipaddress;
}
Zidane (Vi Ly - VietNam)

Jawaban yang mirip dengan “Cara Mendapatkan Alamat IP PC di PHP”

Pertanyaan yang mirip dengan “Cara Mendapatkan Alamat IP PC di PHP”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya