GENWiki

Premier IT Outsourcing and Support Services within the UK

User Tools

Site Tools


php:looking_url_in_phishtank_via_the_api
function PhishTank($url)
{
    $apikey='YOUR API KEY HERE';
    $fields=array('url'=>$url, 'format'=>'json', 'api_key'=>$apikey);
 
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://checkurl.phishtank.com/checkurl/");
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    $curldata=curl_exec($ch);
    $response = (array) json_decode($curldata, true);
    return $response['results']['in_database'];
}

To use the function simply pass a url e.g.

$response=PhishTank('https://www.gen.net.uk');

$response will be boolean, indicating if the site is listed (true) or not (false).

/data/webs/external/dokuwiki/data/pages/php/looking_url_in_phishtank_via_the_api.txt · Last modified: 2019/05/20 10:17 by genadmin

Was this page helpful?-10+1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki