PHP code example of ismystore / checkip
1. Go to this page and download the library: Download ismystore/checkip 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/ */
ismystore / checkip example snippets
use ismystore\checkip\CheckIP;
class MyAwesomeClass{
public function getMyPlayer(Person $person){
$ip = $person->getAddress();
$check = new CheckIP($ip);
$msg = "";
$msg .= "Your country is: ".$check->getCountry()."\n";
$msg .= "Your country code is: ".$check->getCountryCode()."\n";
$msg .= "Your region code is: ".$check->getRegionCode()."\n";
$msg .= "Your state/region name is: ".$check->getState()."\n";
$msg .= "Your city is: ".$check->getCity()."\n";
$msg .= "Your address is: ".$check->getAddress()."\n";
$msg .= "Is a european country ? ".($check->getEuropean() ? "Yes" : "No")."\n";
$msg .= "Your timezone is: ".$check->getTimezone()."\n";
$msg .= "Your currency code is: ".$check->getCurrencyCode()." (".$check->getCurrencySymbol().")\n";
$person->send($msg);
}
}
bash
php tests/test.php