Skip to content

Commit

Permalink
Regex for herold.at updated
Browse files Browse the repository at this point in the history
  • Loading branch information
ladiko committed Apr 2, 2016
1 parent f5864d2 commit db81563
Showing 1 changed file with 24 additions and 29 deletions.
53 changes: 24 additions & 29 deletions sources/source-Herold_Austria.module
Original file line number Diff line number Diff line change
Expand Up @@ -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(
// '~<div class="result-wrap"><h2 class="fullw"><a href=".*?">(.+?)</a></h2>~', // 2014-06-27 working for residential
'~<b>1.</b> <a onclick=".*?" href=".*?">(.+?)</a> </h2>~', // 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(
'~>(.*?)</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);
}
}

0 comments on commit db81563

Please sign in to comment.