koroban / WhoisParser

Lookup domain names, IP addresses and AS numbers by WHOIS
http://www.novutec.com
137 stars 125 forks source link

.ch parsing of non-organizational holder contact (SWITCH) #40

Open onlime opened 9 years ago

onlime commented 9 years ago

Hi there

parsing of SWITCH whois records (.ch/.li domains) won't work in current master (03e0337) for domain holders without organization name. My fix in Templates/Switchnic.php:

# diff -u Switchnic_03e0337.php Switchnic.php 
--- Switchnic_03e0337.php   2014-12-09 16:11:15.000000000 +0100
+++ Switchnic.php   2014-12-09 16:14:37.000000000 +0100
@@ -107,6 +107,13 @@
                         $contactObject->city = $filteredAddress[3];
                         $contactObject->address = $filteredAddress[2];
                         break;
+                    case 4:
+                        $contactObject->organization = '';
+                        $contactObject->name         = $filteredAddress[0];
+                        $contactObject->country      = $filteredAddress[3];
+                        $contactObject->city         = $filteredAddress[2];
+                        $contactObject->address      = $filteredAddress[1];
+                        break;
                     default:
                         //do nothing.
                 }

Thanks. Best regards, Philip

onlime commented 9 years ago

sample WHOIS data:

whois: This information is subject to an Acceptable Use Policy.
See http://www.nic.ch/terms/aup.html

Domain name:
example.ch

Holder of domain name:
Muster Hans
Demostreet 22
CH-8001 Zürich
Switzerland
Contractual Language: German

Technical contact:
Onlime Webhosting
Meloni Stefano
Samplestreet 33
CH-8004 Zürich
Switzerland

DNSSEC:N

Name servers:
ns1.onlime.ch   [80.74.134.40]
ns2.onlime.ch   [46.231.201.211]
ns3.onlime.ch   [80.74.134.53]