PHP code example of worm / getclientiplib

1. Go to this page and download the library: Download worm/getclientiplib library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

worm / getclientiplib example snippets


$getClientIp = new GetClientIp;
$ip = $getClientIp->getClientIp();
$longIp = $getClientIp->getLongClientIp();

$getClientIp = new GetClientIp(array( "REMOTE_ADDR"           => "1.2.3.4",
                                      "REMOTE_PORT"           => "",
                                      "SERVER_ADDR"           => "1.1.1.1",
                                      "X_FORWARDED_FOR"       => "2.3.4.5,1.2.3.4, 1.2.3.4" ));
$ip = $getClientIp->getClientIp();
$longIp = $getClientIp->getLongClientIp();