Skip to content

Commit

Permalink
Merge branch 'bugfix/FREEPBX-12210' of ssh://git.freepbx.org/freepbx/…
Browse files Browse the repository at this point in the history
…superfecta into release/13.0
  • Loading branch information
tm1000 committed May 20, 2016
2 parents 06cd41f + a8e8383 commit 39f17f1
Showing 1 changed file with 38 additions and 28 deletions.
66 changes: 38 additions & 28 deletions sources/source-Herold_Austria.module
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* Developer Notes:
*
* There are two separate URLS for reverse searching, one for yellowpages one for ppl:
* http://www.herold.at/en/telefonbuch/telefon_$thenumber - people
* http://www.herold.at/en/gelbe-seiten/telefon_$thenumber - business
* I could only get reverse searches to work for ppl
* http://www.herold.at/en/telefonbuch/telefon_$thenumber - people
* http://www.herold.at/en/gelbe-seiten/telefon_$thenumber - business
* I could only get reverse searches to work for ppl
*
* herold.at Terms of Service:
* As summarized in the post here on 2014-06-27
Expand All @@ -16,10 +16,10 @@
* Version History:
* 2014-06-28 Initial migration from 2.2.x
* 2014-07-02 Add business lookups and change urls to mobile site
* 2016-05-03 Rewrite Numbers correct for Herold and change Query for new Mobile Web Template
*
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***/


class Herold_Austria extends superfecta_base {

public $description;
Expand All @@ -29,28 +29,38 @@ class Herold_Austria extends superfecta_base {
$this->description = "http://www.herold.at/ - "._("These listings include data for Austria.");
}

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

// Set the url we're searching for
$res_rul = "http://www.herold.mobi/telefonbuch/was_$thenumber/"; // url for searching residential listings
$bus_url = "http://www.herold.mobi/gelbe-seiten/was_$thenumber/"; // url for searching business listings

// regex patterns to search for
$regexp = array(
'~>(.*?)</a> </h2>~',
);

$caller_id="";
// first search for Residential match
if ($this->SearchURL($res_rul, $regexp, $match)) {
$caller_id = $this->ExtractMatch($match);
}

// if no residential match found, search business
if (!$caller_id && $this->SearchURL($bus_url, $regexp, $match)) {
$caller_id = $this->ExtractMatch($match);
}
return($caller_id);
}
function get_caller_id($thenumber, $run_param=array()) {
$this->DebugPrint(_("Searching"). "http://www.herold.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.herold.mobi/telefonbuch/was_".$thenumber."/";// url for searching residential listings
$bus_url = "http://www.herold.mobi/gelbe-seiten/was_".$thenumber."/";// url for searching business listings

// regex patterns to search for
$regexp = array(
'~<a data-clickpos="name" href=".*?">(.+?)</a>~',
);

// first search for Residential match
if ($this->SearchURL($res_rul, $regexp, $match)) {
$caller_id = $this->ExtractMatch($match);
}

// if no residential match found, search business
if ($this->SearchURL($bus_url, $regexp, $match)) {
$caller_id = $this->ExtractMatch($match);
}
$caller_id = isset($caller_id)?$caller_id:'';

return($caller_id);
}

}

0 comments on commit 39f17f1

Please sign in to comment.