forked from kingarthur2/superfecta-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsource-Can_White_Pages.module
37 lines (28 loc) · 1.29 KB
/
source-Can_White_Pages.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
<?php
class Can_White_Pages extends superfecta_base {
public $description = "http://www.whitepages.ca - This site will return residential Canadian listings as well as (at least some) American listings.";
public $version_requirement = "2.11";
function get_caller_id($thenumber, $run_param=array()) {
$caller_id = null;
$npa = "";
$nxx = "";
$station = "";
if (!$this->IsValidNumber(array('US', 'CA'), $thenumber, $npa, $nxx, $station)) {
$this->DebugPrint("Skipping Source - Non Canadian/American number: " . $thenumber);
} else {
$this->DebugPrint("Searching www.whitepages.ca - ({$npa}) {$nxx}-{$station}...");
// By default, there is no match
$name = "";
$url = "http://www.whitepages.ca/phone/1-" . $npa . "-" . $nxx . "-" . $station; //working June 19, 2012
$pattern = '/<span class=\"name\"><a href=\".*\">(.*?)<\/a><\/span>/i'; // Residential match working Jun 19, 2012
// Patterns to search for
$regexp = array(
$pattern,
);
if ($this->SearchURL($url, $regexp, $match, NULL, TRUE)) {
$caller_id = $this->ExtractMatch($match);
}
}
return($caller_id);
}
}