PHP code example of xsist10 / safebrowser
1. Go to this page and download the library: Download xsist10/safebrowser 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/ */
xsist10 / safebrowser example snippets
xsist10\SafeBrowsing\SafeBrowsing;
use xsist10\SafeBrowsing\Strategy\Chain;
use xsist10\SafeBrowsing\Strategy\Post;
use xsist10\SafeBrowsing\Strategy\Get;
$chain = new Chain();
$chain->append(new Post());
$chain->append(new Get());
$safeBrowsing = new SafeBrowsing("[API KEY]", $chain);
$response = $safeBrowsing->isUrlSafe('http://ianfette.org/');
if (!$response->isSecure()) {
// Oh no! Panic!
if ($response->hasMalware()) {
// Malware detected
}
if ($response->hasPhishing()) {
// Phising detected
}
}