1. Go to this page and download the library: Download zeroad.network/token 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/ */
zeroad.network / token example snippets
use ZeroAd\Token\Publisher;
// Create once, reuse across every request - it parses a key and owns the result cache.
$publisher = Publisher::create([
"publisherId" => $_ENV["ZERO_AD_PUBLISHER_ID"],
"hostnames" => "example.com", // covers www.example.com too; pass an array for other hosts
]);
if ($visitor->subscriber) {
// no ads, no trackers, no consent dialog, no paywall
}
$visitor = $publisher->verify($token, $host);
if ($visitor->subscriber) {
$visitor->plan; // Constants::PLAN["FREEDOM"]
$visitor->planName; // "Freedom"
$visitor->expiresAt; // \DateTimeImmutable
} else {
$visitor->reason; // one of the Rejection::* constants
}
$visitor->hostname; // what it was verified against
$visitor->cached; // whether this skipped the cryptography