forked from FreePBX/superfecta
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create source-DasTelefonBuch_Germany.module (FreePBX#297)
- Loading branch information
1 parent
6f06150
commit 3493cd1
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
/*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** | ||
* Developer Notes: | ||
* | ||
* This DasTelefonBuch_Germany Source is looking up for persons companys. | ||
* | ||
* dastelefonbuch.de Terms of Service: | ||
* https://www.dastelefonbuch.de/Datenschutz | ||
* dastelefonbuch.de TOS do not explicitly prohibit automated lookups | ||
* dastelefonbuch.de manages Reverse Number lookups for their customers. Number Search works for all Customers, which dont contradict for this service. | ||
* | ||
* Version History: | ||
* 2017-03-21 Initial Module for DasTelefonBuch_Germany | ||
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***/ | ||
|
||
class DasTelefonBuch_Germany extends superfecta_base { | ||
|
||
public $description; | ||
public $version_requirement = "2.11"; | ||
|
||
public function __construct() { | ||
$this->description = "https://www.dastelefonbuch.de - "._("These listings include data for dastelefonbuch in Germany."); | ||
} | ||
|
||
function get_caller_id($thenumber, $run_param=array()) { | ||
$this->DebugPrint(_("Searching"). "https://www.dastelefonbuch.de ... "); | ||
|
||
if (substr($thenumber, 0, 1) ==! '0') { | ||
$thenumber=trim($thenumber,' '); | ||
$thenumber="00" . $thenumber; | ||
} | ||
if (substr($thenumber, 0, 2) === '00') { | ||
$thenumber=trim($thenumber,' '); | ||
} | ||
|
||
// Set the url we're searching for | ||
$res_rul = "https://www.dastelefonbuch.de/Suche/" . $thenumber;// url for searching persons | ||
|
||
// regex patterns to search for | ||
$regexp = array( | ||
'~<div class="name" title="(.+?)">~', | ||
); | ||
// search for persons match | ||
if ($this->SearchURL($res_rul, $regexp, $match)) { | ||
$caller_id = $this->ExtractMatch($match); | ||
} | ||
$caller_id = isset($caller_id)?$caller_id:''; | ||
|
||
return($caller_id); | ||
} | ||
|
||
} |