Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

get user ip in php

function getIp() {
    $ip = $_SERVER['REMOTE_ADDR'];
 
    if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
        $ip = $_SERVER['HTTP_CLIENT_IP'];
    } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    }
 
    return $ip;
}
Source by phpf1.com #
 
PREVIOUS NEXT
Tagged: #user #ip #php
ADD COMMENT
Topic
Name
9+8 =