gre/geoip

Greip,通过将AI模块部署到您的系统中,保护您的业务免受欺诈和滥用。

2.3.0 2024-03-14 19:28 UTC

This package is auto-updated.

Last update: 2024-09-17 16:16:41 UTC


README

Greip API的官方PHP库

报告问题 · 请求功能 · Greip 网站 · 文档

Packagist Github Repository

Packagist 版本    GitHub代码大小(字节)    API 状态    许可:Apache 2.0    Packagist PHP 版本支持

安装

composer require gre/geoip

用法

以下是使用此库的方法

1. IP地理位置

使用此方法检索给定IP地址的信息。

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);

2. IP威胁

使用此方法检索与给定IP地址相关的威胁情报信息。

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);

3. ASN查找

在此方法中,Greip将帮助您查找任何给定的AS编号,并返回与其相关的所有数据,如:名称、组织(组织名称)、国家、域名、电子邮件、电话、总IP数、所有与给定AS编号相关的路由列表(v4 & v6)等。

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);

4. 国家查找

此方法可以帮助您检索给定国家的信息。

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);

5. 电子邮件验证

此方法为您的系统提供额外的验证层。虽然验证电子邮件语法很重要,但这并不足够。

此方法不仅检查域名有效性,还包括检查邮件服务的可用性、检测一次性电子邮件(临时电子邮件)等。通过使用此方法,您可以确保对电子邮件地址进行更彻底的验证过程。

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("example@domain.com");

// Printing the response
print_r($Email_Response);

6. 电话号码验证

此方法可以作为您系统验证电话号码的额外层。它验证电话号码的语法和有效性。

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);

7. 侮辱性词汇检测

此方法可用于检测对您的网站/应用程序的滥用。在将用户输入发布到公共领域之前,这是一种了解用户输入并确定其中是否包含侮辱性词汇(脏话)的好方法。

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);

8. 防范支付欺诈

通过部署人工智能模块来预防财务损失。

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" => "asdfasdf@gmasail.com",
  "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);

9. IBAN 验证

此方法允许您验证国际银行账户号码(IBANs)并检索与 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);

选项、方法和更多信息

您可以通过访问我们的文档页面来找到此包的完整指南。

致谢

仓库活动

Alt