forked from kingarthur2/superfecta-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsource-Truelocal_AU.module
46 lines (33 loc) · 1.71 KB
/
source-Truelocal_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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
class Truelocal_AU extends superfecta_base {
public $description = "http://truelocal.com.au - These listings include business data for AU.";
public $version_requirement = "2.11";
function settings() {
//configuration / display parameters
//The description cannot contain "a" tags, but can contain limited HTML. Some HTML (like the a tags) will break the UI.
$source_desc = "http://truelocal.com.au - These listings include business data for AU.";
$settings['desc'] = $source_desc;
$settings['version_requirement'] = "2.11";
return($settings);
}
function get_caller_id($thenumber, $run_param=array()) {
$caller_id = null;
$num1 = "";
$num2 = "";
$num3 = "";
if (!$this->IsValidNumber('AU', $this->thenumber, $num1, $num2, $num3)) {
$this->DebugPrint("Skipping Source - Non Australian number: {$this->thenumber}");
} else {
$this->DebugPrint("Searching truelocal.com.au - {$this->thenumber} ... ");
// Since truelocal.com.au's has no reverse lookup, we'll use google
// to get the proper truelocal.com.au page
$url = "http://www.google.com/search?num=10&hl=en&lr=&safe=off&as_qdr=all&q=%22" . $num1 . "+" . $num2 . "+" . $num3 . "%22+site%3Awww.truelocal.com.au%2Fbusiness&btnG=Search";
// Check if we can just pull the name directly from google's index
$pattern = "/<a href=\"http:\/\/www\.truelocal\.com\.au\/business\/[^>]{1,100}>([^,-<]{1,100})/i";
if ($this->SearchURL($url, $pattern, $match)) {
$caller_id = $this->ExtractMatch($match);
}
}
return($caller_id);
}
}