kirimemail/link-check

Check link safety(redirect,safebrowsing,etc)

1.0.9 2019-12-02 11:32 UTC

This package is auto-updated.

Last update: 2024-10-29 05:40:15 UTC


README

Build Status

Usage:

//create checker with default options
$checker = new Kirimemail\LinkCheck\Checker([
    'max_redirects' => 3,
    'whitelist' => [
         '*://google.*',
    ],
    'check_google_safebrowsing' => true,
    'google_api_key' => '', //necessary if you need to check Google Safebrowsing
    'check_phishtank' => true,
    'phishtank_api_key' => '' //optional, but have low rate limit
]);

$status = $checker->check($url);

if ($status === Kirimemail\LinkCheck\Checker::OK) {
    // link is OK
} else {
    // link is suspicious
}

if ($status === Kirimemail\LinkCheck\Checker::DIFFERENT_REDIRECT) {
    // link has different redirect locations
}

if ($status === Kirimemail\LinkCheck\Checker::TOO_MUCH_REDIRECTS) {
    // link has more redirects than expected
}

if ($status === Kirimemail\LinkCheck\Checker::GOOGLE_UNSAFE) {
    // link is considered unsafe by google
}

if ($status === Kirimemail\LinkCheck\Checker::PHISHTANK_VALID) {
    // link is a valid phishing link in phishtank
}