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

Source for file example-multiple.php

Documentation is available at example-multiple.php

  1. <?php
  2. //error_reporting(E_ALL|E_STRICT);
  3.  
  4. set_include_path(get_include_path(. PATH_SEPARATOR . dirname(__FILE__'/../');
  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.     $sphp = new Services_ProjectHoneyPot($access_key);
  18.     $sphp->setResponseFormat('object');
  19.  
  20.     //$ip = $_SERVER['REMOTE_ADDR'];
  21.     //$ip = '24.132.194.14';
  22.     //$ip = '62.75.159.212';
  23.     //$ip = 'heise.de';
  24.  
  25.     $ips = array('24.132.194.14''62.75.159.212''heise.de''81.169.145.28');
  26.  
  27.     $status $sphp->query($ips);
  28.  
  29. }
  30.     echo '<br />MSG: ' .$e->getMessage();
  31.     echo '<br />CODE: ' $e->getCode();
  32.     exit;
  33. }
  34. if (count($status== 0{
  35.     die("No results.");
  36. }
  37.  
  38. echo "<h1>COUNT: " count($status"</h1>";
  39.  
  40. var_dump($status);
  41.  
  42. foreach ($status AS $res{
  43.     $ip  key($res);
  44.     $res $res[$ip];
  45.  
  46.     if ($res === false{
  47.         echo 'Don\'t bother. Probably a regular user. ;-)' "\n";
  48.     else {
  49.         if ($res->isHarvester()) {
  50.             echo '<h1>OMG, a harvester!!!</h1>';
  51.             echo '<pre>'var_dump($res); echo '</pre>';
  52.         }
  53.     }
  54. }
  55. ?>

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