Advertisement
Guest User

Untitled

a guest
Oct 20th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.74 KB | None | 0 0
  1. <?php
  2.  
  3. class WhoCalled_UK extends superfecta_base {
  4.  
  5.     public $description = "http://who-called.co.uk - A datasource devoted to identifying telemarketers. These listings are provided by other users of this service.";
  6.     public $version_requirement = "2.11";
  7.     public $source_param = array(
  8.         'Get_SPAM_Score' => array(
  9.             'description' => 'Use who-called.co.uk for spam scoring (Harassing & Dangerous).',
  10.             'type' => 'checkbox',
  11.             'default' => 'on'
  12.         )
  13.     );
  14.  
  15.     function get_caller_id($thenumber, $run_param=array()) {
  16.         //This debug variable allows simple copy and past of most sources.
  17.         $debug = $this->debug;
  18.  
  19.         $caller_id = null;
  20.  
  21.         if (!$this->IsValidNumber('UK', $thenumber)) {
  22.             $this->DebugPrint("Skipping Source - Non UK number: $thenumber");
  23.         } else {
  24.             $this->DebugPrint("Searching who-called.co.uk ... ");
  25.  
  26.             $url = "http://who-called.co.uk/Number/$thenumber";
  27.             $value = $this->get_url_contents($url);
  28.  
  29.                 $start = strpos($value, 'No comments yet');
  30.                 if ($start > 0) {
  31.                     $caller_id = ''; // Not a telepest
  32.                     $this->DebugPrint("not found");
  33.                 } else {
  34.                     $start = strpos($value, 'class="dataColumn">Harassing') || strpos($value, 'class="dataColumn">Dangerous');
  35.                     if ($start > 0) {
  36.                         if ($run_param['Get_SPAM_Score'] == 'on') {
  37.                             $this->spam = true; // Reported as a telepest
  38.                             $this->DebugPrint("SPAM caller");
  39.  
  40.                     }
  41.                 }
  42.             }
  43.         }
  44.  
  45.         return($caller_id);
  46.     }
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement