Feature #250
User Request for Austrian data source
| Status: | Feedback | Start: | 11/26/2009 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assigned to: | - | % Done: | 0% |
|
| Category: | - | |||
| Target version: | Caller ID Superfecta Source Files |
Description
By Wolf Paul, Monday, November 16, 2009 @ 10:31 am
Here is a source for Austrian reverse lookups:
Go to http://www.herold.at/telefonbuch/erweiterte-suche/ and fill in the “Telefonnummer” field with the number you are trying to look up, either in national format 0XXXXXXX or in one of two international formats 00CCCXXXXXXX or +CCCXXXXXXXX then click “Finden” on the right.
If found, this will return the name of the party in the bottom right quadrant of the screen, below the pale grey words “Redaktionelle Eintraege” and a . The name is actually a link leading to a more complete record for the party.
The returned web page will have the number in the URL; but simply putting the number in the URL and hitting ENTER will NOT find that party. However, if you call such a URL from wget it will work, but if you call it in the same browser window as a previous search it will not.
History
Updated by lgaetz over 1 year ago
I have a good start on source code for this lookup source. There is no number checking for valid number because I know nothing about proper Austrian number formats. Also, as it is written below, it only works when one result comes up. Phone numbers that yeild more than one result will give a "not found", but with a bit more work, it shouldn't be hard to get that working. There is probably a better way to parse URL contents than the way I did it, but this works.
<?php
//this file is designed to be used as an include that is part of a loop.
//If a valid match is found, it should give $caller_id a value
//available variables for use are: $thenumber
//retreive website contents using get_url_contents($url);
//configuration / display parameters
//The description cannot contain "a" tags, but can contain limited HTML. Some HTML (like the a tags) will break the UI.
$source_desc = "Searches http://www.herold.at/telefonbuch <br>This data source requires Superfecta Module version 2.2.1 or higher.";
//run this if the script is running in the "get caller id" usage mode.
if($usage_mode == 'get caller id')
{
if($debug)
{
print "Searching http://www.herold.at/telefonbuch/ ... ";
}
$url="http://www.herold.at/telefonbuch/telefon_".$thenumber."/";
$value = get_url_contents($url);
if ($value == "")
{
$notfound = true;
$name = "";
}
else
{
// Check to see if only one result comes up
if ((strpos($value, '<h1><strong>Treffer 1-1 </strong>')) > 0)
{
$end = strpos($value, '</a></h2><div class="addrF"><p>');
$begin = (strpos($value, '/">', ($end-100)))+3;
$name = trim(substr($value, $begin, $end-$begin));
}
else
{
// search string for multiple results goes here not done yet
$name = "";
}
}
if(strlen($name) > 1)
{
$caller_id = strip_tags($name);
}
else if($debug)
{
print "not found<br>\n";
}
}
?>
Updated by lgaetz over 1 year ago
Got working code for multiple results now. If search reveals more than 1 result, CNAM is taken as the first result and the remainder are ignored. This code is ready for testing:
{
// Check to see if only one result comes up
if ((strpos($value, '<h1><strong>Treffer 1-1 </strong>')) > 0)
{
$end = strpos($value, '</a></h2><div class="addrF"><p>');
$begin = (strpos($value, '/">', ($end-100)))+3;
$name = trim(substr($value, $begin, $end-$begin));
}
else
{
// search string for multiple results
$end = strpos($value, '</a></h2><div class="addr');
$begin = (strpos($value, 'bold">', ($end-100)))+6;
$name = trim(substr($value, $begin, $end-$begin));
}
Updated by lgaetz over 1 year ago
I am stalled on this until someone with an knowlede of Austrian Phone numbers and an interest in testing it contacts me.
Updated by tshif about 1 year ago
- Status changed from Reviewed to Assigned
- Assigned to set to lgaetz
- % Done changed from 0 to 20
Does anyone know how to reach By Wolf Paul, the original requester?
Updated by tshif about 1 year ago
- Status changed from Assigned to Feedback
- Assigned to deleted (
lgaetz)
Updated by lgaetz about 1 year ago
- % Done changed from 20 to 0
To summarize what little I did to bring anyone up to date who may be planning to continue with this source. I don't understand how Austrian phone numbers work, some seem to have a trailing zero that this site doesn't want to see. Random example: google search for "Innsbruck hotel", yields this number: "0512 598680", which appears to be a valid Austrian number. But the site will only give the proper CNAM if you search for "0512 59868" (no final zero). It may be a simple matter of trimming final zeros off, but all numbers don't have trailing zeros. I hope this will make sense to someone familiar with Austrian DIDs.
Also the url parsing in the above doesn't work anymore, they seem to have changed the output format. Number checking never did work, so the only useful line of code from above is this:
$url="http://www.herold.at/telefonbuch/telefon_".$thenumber."/";
provided you alter the number appropriately first of course.