Skip to content

Commit

Permalink
FREEPBX-12210 Fix Query
Browse files Browse the repository at this point in the history
  • Loading branch information
mitterhuemer authored and tm1000 committed May 3, 2016
1 parent 64798a9 commit fbca8c2
Showing 1 changed file with 31 additions and 27 deletions.
58 changes: 31 additions & 27 deletions sources/source-Herold_Austria.module
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* 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
* 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:
Expand All @@ -16,6 +16,7 @@
* 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 Fix code for new Herold mobile site template / Rewrite Number if cid is not correctly given from trunk for herold.
*
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***/

Expand All @@ -29,29 +30,32 @@ 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);
}
$caller_id = isset($caller_id)?$caller_id:'';
return($caller_id);
}
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
//Maybe uncomment this when you get the number from your trunk with leading +
//$thenumber=trim($thenumber,' ');
//$thenumber="00" . $thenumber;

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

$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);
}
$caller_id = isset($caller_id)?$caller_id:'';
return($caller_id);
}
}

0 comments on commit fbca8c2

Please sign in to comment.