Bug #41
White Pages Returns Individual Name vs. Company Name
| Status: | Closed | Start: | 05/08/2009 | |
|---|---|---|---|---|
| Priority: | Low | Due date: | ||
| Assigned to: | jacobsj | % Done: | 100% |
|
| Category: | - | |||
| Target version: | Caller ID Superfecta v 2.0.0 |
Description
(Posted by MageMinds in pbxiaf forums: http://pbxinaflash.com/forum/showpost.php?p=26556&postcount=160)
With WhitePages.com when a company was calling It was receiving the president name instead of the company name. Here is the submitters modified script to get the company name.
Submitters notes: I'm pretty sure my RegEx pattern can be improved, but it's working for now...
Code:
if ($WhitePagesCAD=='1' && $TFnpa=='0' && $validnpa=='1') :
if ($debug=='1') :
echo "<br />WhitePagesCAD lookup ....", "\n" ;
endif ;
$url = "http://www.whitepages.com/search/ReversePhone?full_phone=$thenumber";
$value = UrlGetContentsCurl($url, $timeout, $debug);
if ($value) :
$notfound = strpos($value, "PHONE_USER_ERROR");
$patternFirst = "/FIRST.*?\"(.*?)\",/";
$patternLast = "/LAST.*?\"(.*?)\",/";
$patternCity = "/CITY.*?\"(.*?)\",/";
$patternState = "/STATE.*?\"(.*?)\",/";
$patternType = "/Type: <\/span>/";
// added/modified by MageMinds
$patternCie = "/Company: <\/strong><span class=\"org\">(.?)<\/span>/";
preg_match($patternCie, $value, $cie);
$name = $cie1;
if ($name==""):
preg_match($patternFirst, $value, $first);
preg_match($patternLast, $value, $last);
$name = $last1." ".$first1;
endif;
// end of MageMinds addition/modification
if (trim($name)==""):
preg_match($patternCity, $value, $city);
preg_match($patternState, $value, $state);
preg_match($patternType, $value, $type);
// $type = str_replace( "<strong>", "", $type );
// $type = str_replace( "</strong>", "", $type );
$name = $city1.", ".$state1." ".$type1;
endif;
if ($notfound):
$name="";
endif;
if (strlen($name)>1) :
echo strip_tags($name);
if ($debug<>'1') :
exit ;
endif;
endif;
endif ;
endif ;
History
Updated by tshif almost 3 years ago
This bug post is LOW CONFIDENCE. The submitter seems a little confused about what program he is talking about - it may not be this one. LOL. Recommend test before addressing.
Updated by tshif almost 3 years ago
- Priority changed from Urgent to Low
- Target version changed from Caller ID Superfecta v 2.0.0 to Caller ID Superfecta v 2.1.0
Moved to future version. Non critical issue, unable to verify.
Updated by jacobsj almost 3 years ago
Can you provide a phone number for which this is happening?
I'm also still getting a comma only one on this phone number: 8665974781
Updated by tshif almost 3 years ago
Here is the number to look for: 604-732-7816.
http://www.whitepages.com/search/ReversePhone?full_phone=604-732-7816
Updated by jacobsj almost 3 years ago
I added MageMinds code but didn't see any difference on the phone number above in testing. It doesn't seem to break anything either, and it may be working in some cases so I left the code in with some comments.
I also found that the occasional comma being returned by WhitePages had to do with phone numbers for which they had no information. Particularly toll free numbers seem to do this more frequently. I added code to correct this, so I don't believe it's returning a comma any longer in those cases.
Updated by tshif almost 3 years ago
- Status changed from New to Resolved
- Target version changed from Caller ID Superfecta v 2.1.0 to Caller ID Superfecta v 2.0.0
- % Done changed from 0 to 90
No apparent failures. I would like to see this tested a little more - if there is time. I am ok with releasing in its current format however.
Updated by tshif almost 3 years ago
- Status changed from Resolved to Assigned
FAILS QA:
White pages code to get business name when present FAILS. It still returns the Persons name, instead of the business name. test case made using: 6047327816 as suggested in note # 5 above.
Updated by jacobsj almost 3 years ago
- % Done changed from 90 to 100
I believe this is fixed now.
I tested against 604-732-7816 and 636-379-1952, both of which are company phone numbers that were returning first and last name previously and now they both correctly return the company name.
Updated by jacobsj almost 3 years ago
- Status changed from Assigned to Closed
Updated by tshif almost 3 years ago
Tested white pages business name retrieval on PBXIAF, PABX, FONCORDIAX, and TRIXBOXCE. All platforms passed perfectly. No problems found.