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
443 stars 118 forks source link

Response time? #196

Open edcoke opened 1 year ago

edcoke commented 1 year ago

We are responsible for 70+ domains. I've built a cron job that scans these domains 2x/day to make sure nothing critical has been changed. I've got 2 problems. First, the WHOIS call takes - usually - something on the order of 2+minutes to return a result for each domain. Multiplied by 70+ domains, it takes the cron job almost 3.5 hours to run through all of the domains. Is there anything I can do to improve response time? Also the dates returned from one call to the next are almost always different. Difference can be anything from a few minutes to years. I would think those dates (created, updated, expires) should be relatively static.

For the record, doing a fairly vanilla call: $lookup = $whois->loadDomainInfo($domainList[$d]);

...and then parsing the dates: $created = date('Y-m-d H:i:s', $lookup->creationDate); $updated = date('Y-m-d H:i:s', $lookup->updatedDate); $expires = date('Y-m-d H:i:s', $lookup->expirationDate);

Any suggestions welcomed.

io-developer commented 1 year ago

Hi, Check Loaders package - https://github.com/io-developer/php-whois/tree/master/src/Iodev/Whois/Loaders There is interface ILoader for a custom loader implementation. And caching example - https://github.com/io-developer/php-whois/blob/master/src/Iodev/Whois/Loaders/MemcachedLoader.php

Timeout can be changed here - https://github.com/io-developer/php-whois/blob/master/src/Iodev/Whois/Loaders/SocketLoader.php#L34