forked from kingarthur2/superfecta-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsource-PhoneLookup_UK.module
44 lines (35 loc) · 1.48 KB
/
source-PhoneLookup_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
<?php
class PhoneLookup_UK extends superfecta_base {
public $description = "http://www.ukphonelookup.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', $thenumber)) {
$this->DebugPrint("Skipping Source - Non UK number: {$thenumber}");
} else {
$this->DebugPrint("Searching Phone Lookup UK for number: {$thenumber}");
$url = "http://www.ukphonelookup.co.uk/{$thenumber}-phone-number-check";
$value = $this->get_url_contents($url);
if (is_numeric($value)) {
$this->DebugPrint(" value of {$value} returned ... ");
$score = $value;
if ($score > $run_param['SPAM_Threshold']) {
$this->DebugPrint(" determined to be SPAM");
$this->spam = true;
} else {
$this->DebugPrint("Not a SPAM caller");
}
} else {
$this->DebugPrint("not found");
}
}
return($caller_id);
}
}