-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsource-ReversePhoneBooks_UK.module
48 lines (39 loc) · 1.76 KB
/
source-ReversePhoneBooks_UK.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
class ReversePhoneBooks_UK extends superfecta_base {
public $description = "http://www.reversephonebooks.co.uk - A datasource devoted to identifying telemarketers. These listings are provided by other users of this service.";
public $version_requirement = "2.11";
public $source_param = array(
'SPAM_Threshold' => array(
'description' => 'Specify the # of listings required to mark a call as spam.',
'type' => 'number',
'default' => 10
)
);
function get_caller_id($thenumber, $run_param=array()) {
$caller_id = NULL;
if (!$this->IsValidNumber('UK', $this->thenumber)) {
$this->DebugPrint("Skipping Source - Non UK number: {$this->thenumber}");
} else {
$this->DebugPrint("Searching ReversePhoneBooks.co.uk ... ");
$url = "http://www.reversephonebooks.co.uk/{$this->thenumber}-phone-number";
$value = $this->get_url_contents($url);
$pattern = "/<p>There are (\d+) reported complaint([s]*) for phone number/";
if ($this->SearchURL($url, $pattern, $match)) {
$value = $this->ExtractMatch($match);
if (is_numeric($value)) {
$this->DebugPrint(" value of {$value} returned ... ");
$score = $value;
if ($score > $run_param['SPAM_Threshold']) {
$this->spam = true;
$this->DebugPrint(" determined to be SPAM");
} else {
$this->DebugPrint("Not a SPAM caller");
}
return($caller_id);
}
}
$this->DebugPrint("not found");
return(NULL);
}
}
}