forked from kingarthur2/superfecta-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsource-Google_Maps_AU.module
31 lines (21 loc) · 1.08 KB
/
source-Google_Maps_AU.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
<?php
class Google_Maps_AU extends superfecta_base {
public $description = "http://maps.google.com.au - These listings include business data for Australia.<br><br>This data source requires Superfecta Module version 2.11 or higher.";
public $version_requirement = "2.11";
function get_caller_id($thenumber, $run_param=array()) {
$caller_id = null;
if (!$this->IsValidNumber('AU', $this->thenumber)) {
$this->DebugPrint("Skipping Source - Non Australian number: {$this->thenumber}");
} else {
$this->DebugPrint("Searching maps.google.com.au for number: {$this->thenumber}");
// We'll be searching google maps
$url = "http://maps.google.com.au/?mode=search&q={$this->thenumber}";
// Grab the first result from google maps that matches our phone number
$pattern = "/title:\'{$this->thenumber}.*sxti:\'(.*)\'/U";
if ($this->SearchURL($url, $pattern, $match)) {
$caller_id = $this->ExtractMatch($match);
}
}
return $caller_id;
}
}