io-developer / php-whois

PHP WHOIS provides parsed and raw whois lookup of domains and ASN routes. PHP 8.0 compatible (5.4+ old versions)
MIT License
440 stars 118 forks source link

Invalid .ir parsing #91

Closed mhf-ir closed 3 years ago

mhf-ir commented 4 years ago

PHP-Whois version: 3.4.3

PHP version: 7.3.11

Description
test mhf.ir domain

How to reproduce

<?php

        $whois = Whois::create();
        $info = $whois->loadDomainInfo('mhf.ir');
        var_dump($info->getCreationDate()); // 0 or null
        var_dump($info->getExpirationDate()); // 0 or null
        var_dump($info->getOwner()); // null or address instead

Possible Solution
Check regex i think

Additional context
http://whois.nic.ir/WHOIS?name=mhf.ir

mhf-ir commented 4 years ago

.ir It's 11nd of total usage in world: https://w3techs.com/technologies/overview/top_level_domain

io-developer commented 4 years ago

Note: possible custom query. whois-cli uses:

whois mhf.ir --verbose
Using server whois.nic.ir.
Query string: "-V Md5.2 mhf.ir"
mhf-ir commented 4 years ago
whois mhf.ir --verbose
Using server whois.nic.ir.
Query string: "-V Md5.2 mhf.ir"

% This is the IRNIC Whois server v1.6.2.
% Available on web at http://whois.nic.ir/
% Find the terms and conditions of use on http://www.nic.ir/
% 
% This server uses UTF-8 as the encoding for requests and responses.

% NOTE: This output has been filtered.

% Information related to 'mhf.ir'

domain:     mhf.ir
ascii:      mhf.ir
remarks:    (Domain Holder) Muhammad Hussein Fattahizadeh
remarks:    (Domain Holder Address) No. 125, 4 West St, Janbazan Av., Semnan, Semnan, IR
holder-c:   mf233-irnic
admin-c:    no297-irnic
tech-c:     no297-irnic
bill-c:     no297-irnic
nserver:    ns1.aasaam.net
nserver:    ns2.aasaam.net
nserver:    ns3.aasaam.net
nserver:    ns4.aasaam.net
last-updated:   2018-04-27
expire-date:    2020-09-23
source:     IRNIC # Filtered

nic-hdl:    mf233-irnic
person:     Muhammad Hussein Fattahizadeh
e-mail:     semnanweb@gmail.com
address:    No. 125, 4 West St, Janbazan Av., Semnan, Semnan, IR
phone:      +98 231 3583834
source:     IRNIC # Filtered

nic-hdl:    no297-irnic
org:        Noavaran Shabake Sabz Mehregan (HostIran Networks)
e-mail:     esmailian@hostiran.com
address:    #16, 2nd block , 1000 Building , Seydkhandan Bridge , Shariati st., Tehran, Tehran, IR
phone:      +982122880312
fax-no:     +982122880311
source:     IRNIC # Filtered
io-developer commented 4 years ago

Just left note for future. No time to fix now. Also you can try to tune https://github.com/io-developer/php-whois/blob/master/src/Iodev/Whois/Configs/module.tld.servers.json There are some examples with custom query (.DE if I remeber)

io-developer commented 4 years ago

Not confirmed. It's loading and parsing very good from a box. Anyway I added in master extra host with query format.

Also added unit test case. Found one issue and can't fix it in near future due to other one test fails. Issue is: owner field is fillied from 'address' instead of 'person'

io-developer commented 3 years ago

In current version is OK. Creation date is missing so it's 0

'owner' =>
    string(52) "No. 125, 4 West St, Janbazan Av., Semnan, Semnan, IR"
    'registrar' =>
    string(27) "Faraso Samaneh Pasargad Co."
    'creationDate' =>
    int(0)
    'expirationDate' =>
    int(1758661200)
    'updatedDate' =>
    int(1603400400)