Google Safe Browsing batch server, client
MIT License
This implements a toolkit for implementing the Google Safe Browsing API v2
The lib directory contains the pieces you'll need to assemble to match your enivroment:
bin-sample shows how this might be done. You'll want to rewrite these for match your environment:
The URL lookup and the local database update shares common code:
$api = 'YOUR-API-KEY-HERE';
$gsblists = array('goog-malware-shavar', 'googpub-phish-shavar');
// make a PDO object, 2nd line is just good practice
$dbh = new PDO('mysql:host=127.0.0.1;dbname=gsb', 'root');
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// create the pieces. Subclass, over-ride for your environment
$storage = new GSB_StoreDB($dbh);
$network = new GSB_Request($api);
$logger = new GSB_Logger(5);
To make URL checker:
// make the client with the pieces, and test
$client = new GSB_Client($storage, $network, $logger);
$client->lookup('A URL');
To make a database updater:
$x = new GSB_Updater($storage, $network, $logger);
$x->downloadData($gsblists, FALSE);
$storage->fullhash_delete_old();