FreePBX / superfecta

Provides simultaneous use of, and complete control over multiple caller id data sources.
http://www.freepbx.org
GNU General Public License v2.0
58 stars 93 forks source link

Herold Austria combined Yellow & White Pages URL search #207

Open charles-darwin opened 10 years ago

charles-darwin commented 10 years ago

The Herold Business URL (Yellow Pages) somehow blocks any URL requests...whereas (thanks to lgaetz) the White Pages work fine.

I found a workaround: There is a Herold webinterface for mobile devices and this URL works http://www.herold.mobi/suche/was_telefon_/

The beauty is that it is a combined search (Herold White & Yellow Pages Austria).

Here's an example for Yellow: http://www.herold.mobi/suche/was_01313390/

...and here for White: http://www.herold.mobi/suche/was_0800222666/

Here`s the page with limited english support ;-) http://www.herold.mobi/suche/was_01313390/?lang=en

Ciao CD

tm1000 commented 10 years ago

The user may use the HERALD databases for their personal, non-commercial information retrieval. The own information gathering is certain companies and individuals with the appropriate information (address, phone number, etc.) to find. Use of the search results may only be made for your own non-commercial purposes. It is not permitted in particular use in connection with the commercial address utilization, the use of the structure or to complement participants, company or other directories of any kind and in any form of media (in print form, electronic, CD-ROM etc.) use to carry out an information service or a call center, using the issue of telephone information, the use for marketing or advertising purposes, the use in building competitive products to products of HEROLD (especially HEROLD CD-ROM or DVD product range, HEROLD single address sales, etc .), the use for any other commercial purposes as well as for general purposes or in the interests of third parties. Furthermore, any use of the Services, which can lead to damage of an overload or other impairment of the functionality of the Services, and generally inadmissible for illegal purposes. The user will HEROLD for all damages resulting from any unauthorized use of the Services, indemnify and hold harmless.

charles-darwin commented 10 years ago

Well, the text doesn't say anything about reverse lookup to display the callers name on an asterisk phone system, does it? ...and it's the .mobi version, which is only used by Iphone & Ipad lovers ;-)

charles-darwin commented 10 years ago

By the way, Auerswald.de has been offering Herold.at lookups for years. It's part of their software in the e.g. Compact 5020 telephone systems. Screenshot of the web interface is attached. bildschirmfoto 2014-06-27 um 17 23 10

lgaetz commented 10 years ago

Updated version ready for testing. Business and residential lookups working now.

charles-darwin commented 10 years ago

Thank you very much, lgaetz!!! I put a new source-Herold-Austria.module file containing the new code into the superfecta/sources folder. However, I don`t get results anymore. It might be my fault... Here's the log for a number which worked with the previous version, but not anymore

<<< debug output removed for brevity >>>
charles-darwin commented 10 years ago

Ok...just realized that it was MY MISTAKE!!! I somehow lost the format during the copy procedure. There were no line intents... Sorry for the false alarm ;-)

Thank you so much for developing this wonderful new feature! :-) :-) :-)

charles-darwin commented 10 years ago

Just one last thing... The description in the Herold_Austria file contains a reference to open79xx.

* Developer Notes:
* Open79xx is an OSS project that provides an XML contact list for Cisco 79XX phones
* and with a web GUI.
* See http://sourceforge.net/projects/open79xxdir/ for project details

It could be removed.

lgaetz commented 10 years ago

Comment block fixed, and some posts to this thread trimmed or deleted to clean up.

tm1000 commented 10 years ago

I put the TOS here for @lgaetz to read and make his own assumptions. Democracy and all. :-)

lgaetz commented 10 years ago

My interpretation is that Superfecta use is permitted. Agree/disagree?

tm1000 commented 10 years ago

I would agree yes.

charles-darwin commented 10 years ago

I would agree too ;-)

charles-darwin commented 9 years ago

I realized that the Herold Austria module stopped working. I am no pro, but I added two small changes and I think it works now. Tested it with Yellow & White Pages number. Here is the updated code, since I cannot upload the file. I changed:

$res_rul = "http://www.herold.mobi/suche/was_$thenumber/";

and

'~<b>1.</b> <a data-clickpos=".*?" href=".*?">(.+?)</a>    </h2>~',  // 2014-07-02 working for residential and business from mobi links
<?php

/*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
 * 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
 * 
 * herold.at Terms of Service:
 * As summarized in the post here on 2014-06-27
 * https://github.com/POSSA/Caller-ID-Superfecta/issues/131#issuecomment-47354154
 * herold.at TOS do not explicitly prohibit automated lookups
 *
 * Version History:
 * 2014-06-28   Initial migration from 2.2.x
 * 2014-07-02   Add business lookups and change urls to mobile site
 * 
 *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***/

class Herold_Austria extends superfecta_base {

    public $description = "http://www.herold.at/ - These listings include data for Austria.";
    public $version_requirement = "2.11";

    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/suche/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 data-clickpos=".*?" 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);
    }

}
charles-darwin commented 8 years ago

Herold-Austria (www.herold.mobi) changed the code. It does not work anymore :-(

mitterhuemer commented 8 years ago
<?php

/*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
* 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
 *
 * herold.at Terms of Service:
 * As summarized in the post here on 2014-06-27
 * https://github.com/POSSA/Caller-ID-Superfecta/issues/131#issuecomment-47354154
 * herold.at TOS do not explicitly prohibit automated lookups
 *
 * 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;
    public $version_requirement = "2.11";

    public function __construct() {
        $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/ ... ");

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
//      $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
        $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
            '~<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);
    }

}