PHP code example of webignition / sfs-querier

1. Go to this page and download the library: Download webignition/sfs-querier 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/ */

    

webignition / sfs-querier example snippets


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

$client = new Cient();

// Query against a single email address
$result = $client->queryEmail('[email protected]');

// $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
}

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