Recommend this page to a friend! |
Classes of Merijn van den Kroonenberg | PHP Google Safe Browsing API | README.md | Download |
|
DownloadWeb2All safebrowsingv4This is a google safebrowsing client (update API V4) written in PHP. For information see the google documentation https://developers.google.com/safe-browsing/v4/update-api. In short the update API keeps track of a local database of hashcodes which is updated using the update API v4 protocol. Any urls will be checked against the local database. When possible matches are found, more hashes will be retrieved from the google service. URLs which are checked are NEVER sent to google, only a hash will be submitted to google. This is the big advantage compared to the Lookup API v4. An additional advantage is less network traffic as initial checks are done against a local database of hash prefixes and the bulk of the checks does not require a roundtrip to the google service. Disadvantage of the Update service compared to the Lookup service is that a local cache/data storage is required and the client must update it periodically. So the client must run as a daemon (or scheduled) to keep the local database up-to-date. The web2all/safebrowsingv4 is no longer actively maintained. What is in this packageThis package contains the google safebrowsing Update API V4 protocol implementation. But it only includes a reference implementation for the local storage (for storing the hash prefix database). This reference implementation is file-based and just an example, it is not suited for production use. For an example of a mysql storage backend implementation of this safebrowsing client, see the UsageInstall using composer (eg. Go to google and request a new API key, see https://developers.google.com/safe-browsing/v4/get-started. For tests run:
To test the safebrowsing client using the example file storage backend create a sample php script:
the above script will create a local hash prefix database in Once above script runs, you can do lookups like this:
WarningDo not use the included FileStorage example storage backend in production! It is not efficeient, its just an implementation example. If you must, use See also
LicenseWeb2All safebrowsingv4 is open-sourced software licensed under the MIT license (https://opensource.org/licenses/MIT). |