Services_ProjectHoneyPot
[ class tree: Services_ProjectHoneyPot ] [ index: Services_ProjectHoneyPot ] [ all elements ]

Source for file example-resolver.php

Documentation is available at example-resolver.php

  1. <?php
  2. //error_reporting(E_ALL|E_STRICT);
  3.  
  4. set_include_path(dirname(__FILE__'/../' . PATH_SEPARATOR . get_include_path());
  5.  
  6. require_once 'Services/ProjectHoneyPot.php';
  7.  
  8. /**
  9.  * config.php, includes:
  10.  * <?php $access_key = '...'; ?>
  11.  * 
  12.  * ... is the access key
  13.  */
  14. include dirname(__FILE__'/config.php';
  15.  
  16. try {
  17.     /**
  18.      * Use a custom Net_DNS2_Resolver with Services_ProjectHoneyPot
  19.      */
  20.     $resolver = new Net_DNS2_Resolver(array(
  21.         'nameservers' => array('66.114.197.251',),
  22.     ));
  23.  
  24.     /**
  25.      * 66.114.197.251 is a authorative NS for dnsbl.httpbl.org
  26.      * :-)
  27.      */
  28.  
  29.     $sphp = new Services_ProjectHoneyPot($access_key$resolver);
  30.     $sphp->setResponseFormat('object');
  31.  
  32.     $status $sphp->query($harvester);
  33.  
  34. }
  35.     echo "\nMSG: " .$e->getMessage();
  36.     echo "\nCODE: " $e->getCode();
  37.     exit;
  38. }
  39.  
  40. if (count($status== 0{
  41.     die("No results.");
  42. }
  43. foreach ($status as $res{
  44.  
  45.     $ip  key($res);
  46.     $res $res[$ip];
  47.  
  48.     if ($res === false{
  49.         echo 'Don\'t bother. Probably a regular user. ;-)' "\n";
  50.     else {
  51.         if ($res->isHarvester()) {
  52.             echo '<h1>OMG, a harvester!!!</h1>';
  53.             echo '<pre>'var_dump($res); echo '</pre>';
  54.         }
  55.     }
  56. }

Documentation generated on Mon, 11 Mar 2019 15:45:14 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.