Skip to content

Commit

Permalink
Create source-TelefonABC_Austria.module (FreePBX#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
mitterhuemer authored and tm1000 committed Mar 30, 2017
1 parent a31b2bf commit 6f06150
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions sources/source-TelefonABC_Austria.module
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

/*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
* Developer Notes:
*
* This TelefonABC Source is looking up for persons and some companys. Officially this module supports only Persons lookup but sometimes there alre also companys in the results.
*
* TelefonABC.at Terms of Service:
* http://www.telefonabc.at/agb.aspx
* TelefonABC.at TOS do not explicitly prohibit automated lookups
* It is not allowed to save the looked up data into a Database and it is prohibited to use the Data for commercial use and adverts.
*
* Version History:
* 2017-03-21 Initial Module for TelefonABC.at
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***/

class TelefonABC_Austria extends superfecta_base {

public $description;
public $version_requirement = "2.11";

public function __construct() {
$this->description = "http://www.telefonabc.at - "._("These listings include data for TelefonABC in Austria.");
}

function get_caller_id($thenumber, $run_param=array()) {
$this->DebugPrint(_("Searching"). "http://www.telefonabc.at ... ");

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 = "http://www.telefonabc.at/result.aspx?what=".$thenumber."&where=&exact=False&firstname=&lastname=&appendix=&branch=&p=0&sid=&did=&cc=";// url for searching persons

// regex patterns to search for
$regexp = array(
'#<h3 itemprop="name" class="card-heading pull-left">(.+?)</h3>#s',
);
// 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);
}

}

0 comments on commit 6f06150

Please sign in to comment.