From db81563e1b479002ff40a938aa8ee980048fc321 Mon Sep 17 00:00:00 2001 From: ladiko Date: Sat, 2 Apr 2016 12:41:37 +0200 Subject: [PATCH] Regex for herold.at updated --- sources/source-Herold_Austria.module | 53 +++++++++++++--------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/sources/source-Herold_Austria.module b/sources/source-Herold_Austria.module index 2416be0c..1acc4d80 100644 --- a/sources/source-Herold_Austria.module +++ b/sources/source-Herold_Austria.module @@ -29,33 +29,28 @@ 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 -// $url = "http://www.herold.at/telefonbuch/telefon_" . $thenumber . "/"; // valid as of 2014-06-27 for residential -// $url = "http://www.herold.mobi/suche/was_$thenumber/"; // 2014-07-02 mostly okay for both residential and business but gives occasional false name - - $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( -// '~

(.+?)

~', // 2014-06-27 working for residential - '~1. (.+?) ~', // 2014-07-02 working for residential and business from mobi links - ); - - // 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/ ... "); + + // 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)) { + $caller_id = $this->ExtractMatch($match); + } + return($caller_id); + } }