The official PHP library for Greip API
Report Issue · Request Feature · Greip Website · Documentation
composer require gre/geoip
Here's how you use the library:
Use this method to retrieve the information of a given IP address.
include_once __DIR__ . "/vendor/autoload.php";
// Declaring the classes we need
$config = new Greip\API\Config();
$GeoIP = new Greip\API\GeoIP();
// Setting the API Key
$config->setToken("<API-Key>");
// Sending the request and storing the output in a variable
$GeoIP_Response = $GeoIP->lookup("1.1.1.1");
// Printing the response
print_r($GeoIP_Response);
Use this method to retrieve threat intelligence information associated with a given IP address.
include_once __DIR__ . "/vendor/autoload.php";
// Declaring the classes we need
$config = new Greip\API\Config();
$GeoIP = new Greip\API\GeoIP();
// Setting the API Key
$config->setToken("<API-Key>");
// Sending the request and storing the output in a variable
$GeoIP_Response = $GeoIP->threats("1.1.1.1");
// Printing the response
print_r($GeoIP_Response);
In this method, Greip will help you lookup any given AS Number and returning all data related to it, like: name, org (the organization name), country, domain, email, phone, totalIPs, list of all routes (v4 & v6) related the given AS Number, etc.
include_once __DIR__ . "/vendor/autoload.php";
// Declaring the classes we need
$config = new Greip\API\Config();
$GeoIP = new Greip\API\GeoIP();
// Setting the API Key
$config->setToken("<API-Key>");
// Sending the request and storing the output in a variable
$ASN_Response = $GeoIP->asn("AS01");
// Printing the response
print_r($ASN_Response);
This method can help you retrieve information of the given country.
include_once __DIR__ . "/vendor/autoload.php";
// Declaring the classes we need
$config = new Greip\API\Config();
$GeoIP = new Greip\API\GeoIP();
// Setting the API Key
$config->setToken("<API-Key>");
// Sending the request and storing the output in a variable
$Country_Response = $GeoIP->country("US", ["language", "timezone", "currency"]);
// Printing the response
print_r($Country_Response);
This method provides an additional layer of validation for your system. While validating email syntax is important, it is not sufficient.
This method goes beyond syntax validation by checking the domain’s validity, the availability of the Mail Service, detecting Disposable Email (Temporary Emails), etc. By utilising this method, you can ensure a more thorough validation process for email addresses.
include_once __DIR__ . "/vendor/autoload.php";
// Declaring the classes we need
$config = new Greip\API\Config();
$Fraud = new Greip\API\Fraud();
// Setting the API Key
$config->setToken("<API-Key>");
// Sending the request and storing the output in a variable
$Email_Response = $Fraud->email("[email protected]");
// Printing the response
print_r($Email_Response);
This method can be used as an extra-layer of your system for validating phone numbers. It validates phone number syntax and valid-possibility.
include_once __DIR__ . "/vendor/autoload.php";
// Declaring the classes we need
$config = new Greip\API\Config();
$Fraud = new Greip\API\Fraud();
// Setting the API Key
$config->setToken("<API-Key>");
// Sending the request and storing the output in a variable
$Phone_Response = $Fraud->phone("000000000", "US");
// Printing the response
print_r($Phone_Response);
This method can be used to detect abuse of your website/app. It’s a great way to know more about your user inputs and whether they contain profanity (bad words) or not before releasing them to the public.
include_once __DIR__ . "/vendor/autoload.php";
// Declaring the classes we need
$config = new Greip\API\Config();
$Fraud = new Greip\API\Fraud();
// Setting the API Key
$config->setToken("<API-Key>");
// Sending the request and storing the output in a variable
$Profanity_Response = $Fraud->profanity("This is a sample text", true, false);
// Printing the response
print_r($Profanity_Response);
Prevent financial losses by deploying AI-Powered modules.
include_once __DIR__ . "/vendor/autoload.php";
// Declaring the classes we need
$config = new Greip\API\Config();
$Fraud = new Greip\API\Fraud();
// Setting the API Key
$config->setToken("<API-Key>");
// Declaring Transaction Data
$data = [
"action" => "purchase",
"website_domain" => "example.com",
"merchant_id" => 21,
"customer_id" => 1,
"customer_ip" => "1.0.0.2",
"customer_email" => "[email protected]",
"customer_phone" => "32423434",
"customer_country" => "US",
"transaction_amount" => 100000,
"transaction_currency" => "USD",
"customer_useragent" => "Mozill almaden sdfwer",
];
// Sending the request and storing the output in a variable
$Payment_Response = $Fraud->payment($data);
// Printing the response
print_r($Payment_Response);
This method allows you to validate International Bank Account Numbers (IBANs) and retrieve additional information about the country associated with the IBAN.
include_once __DIR__ . "/vendor/autoload.php";
// Declaring the classes we need
$config = new Greip\API\Config();
$Fraud = new Greip\API\Fraud();
// Setting the API Key
$config->setToken("<API-Key>");
// Sending the request and storing the output in a variable
$IBAN_Response = $Fraud->iban("FO9264600123456789");
// Printing the response
print_r($IBAN_Response);
You can find the full guide of this package by visiting our Documentation Page.