webignition/sfs-querier

用于查询api.stopforumspam.com并提供帮助分析/理解结果的元包

0.1 2019-04-12 15:53 UTC

This package is auto-updated.

Last update: 2024-09-13 03:48:30 UTC


README

PHP(元)包,用于查询api.stopforumspam.com并提供帮助分析/理解结果。

安装

composer require webignition/sfs-querier

api.stopformumspam.com 概述

api.stopformumspam.com 可以通过电子邮件地址、电子邮件哈希、IP地址或用户名进行查询。可以提供可选标志来影响返回的结果类型。

如果不熟悉,请先阅读api.stopformumspam.com 使用指南

使用方法

快速使用示例

use webignition\SfsClient\Client;
use webignition\SfsResultInterfaces\ResultInterface;

$client = new Cient();

// Query against a single email address
$result = $client->queryEmail('user@example.com');

// $result will be NULL if the HTTP request to query api.stopforumspam.com failed for any reason

if ($result instanceof ResultInterface) {
    $result->getType();                 // 'email', 'emailHash', 'ip' or 'username'
    $result->getFrequency();            // int
    $result->getAppears();              // bool
    $result->getValue();                // the email address, email hash, IP address or username
    $result->getLastSeen()              // \DateTime()|null
    $result->getConfidence()            // float|null
    $result->getDelegatedCountryCode(); // string|null
    $result->getCountryCode();          // string|null
    $result->getAsn();                  // int|null
    $result->isBlacklisted();           // bool
    $result->isTorExitNode();           // bool|null
}

阅读有关创建请求查询的更多信息。

理解和分析结果

你可能想知道一个给定的电子邮件地址/IP地址/用户名是否可以在你的应用程序中执行操作时被信任。

use webignition\SfsResultAnalyser\Analyser;
use webignition\SfsResultInterfaces\ResultInterface;

// We're assuming that $result is a ResultInterface object.

$analyser = new Analyser();

// Does a given result indicate that the entity is not to be trusted?
$analyser->isUntrustworthy($result));
// returns true or false

// Is a given result's entity trustworthy?
// Return a float between 0 (do not trust) and 1 (probably can be trusted)
$trustworthiness = $analyser->calculateTrustworthiness($result);