diff --git a/sources/source-Herold_Austria.module b/sources/source-Herold_Austria.module index 9bb0882a..9c67a5fb 100644 --- a/sources/source-Herold_Austria.module +++ b/sources/source-Herold_Austria.module @@ -6,7 +6,7 @@ * 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 + * 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 @@ -16,11 +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 Fix code for new Herold mobile site template / Rewrite Number if cid is not correctly given from trunk for herold. + * 2016-05-03 Rewrite Numbers correct for Herold and change Query for new Mobile Web Template * *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***/ - class Herold_Austria extends superfecta_base { public $description; @@ -33,29 +32,35 @@ class Herold_Austria extends superfecta_base { 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 - if(strpos($thenumber, '+') === 0){ - $thenumber=trim($thenumber,'+ '); + 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( '~(.+?)~', ); - $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)) { + if ($this->SearchURL($bus_url, $regexp, $match)) { $caller_id = $this->ExtractMatch($match); } $caller_id = isset($caller_id)?$caller_id:''; + return($caller_id); } + }