0

I need to test a whois service to test domain names with PHP and a proxy connection with authentification. It works very well for whois.verisign-grs.com for the .com or whois.nic.fr for the .fr, but for the .org, I have the following result, and I don't understand what command it is waiting for? I couldn't find a doc to refer me.

Thanks !

result : string(57) "Neither object nor interpretation control keyword found "

$server='whois.pir.org';
$domain='archive.org';
$useragent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1";
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL,$server);
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
            curl_setopt($ch, CURLOPT_HEADER, 0);
            curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, true);
            curl_setopt($ch, CURLOPT_USERAGENT, $useragent);

            curl_setopt($ch, CURLOPT_PROXYPORT, $port);
            curl_setopt($ch, CURLOPT_PROXY, $proxy);
            curl_setopt($ch, CURLOPT_PROXYTYPE, 'CURLPROXY_SOCKS5'); 
            curl_setopt($ch, CURLOPT_PROXYUSERPWD, $userpass);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_TIMEOUT, 10);
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "$domain \r\n");
            //curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "-T dn $domain\r\n");

            $result = curl_exec($ch);
            var_dump($result);
            curl_close($ch);

Mikael
  • 21
  • 2
  • It seems not related to code; related to the server response itself. – Raptor Jan 07 '20 at 06:49
  • whois is not HTTP. It is simple TCP over port 43. Hence you should use a TCP library not an HTTP one – Patrick Mevzek Jan 08 '20 at 15:57
  • I tried to go through fsockopen which is more appropriate, but the daily limitations of Whois by IP (I have a lot of domain names to test per day) forces me to go through proxies. But I haven't found any technical solutions to use fsockopen behind a proxy... – Mikael Jan 14 '20 at 19:01

1 Answers1

0

WHOIS is NOT a HTTP protocol.

If you need to access the WHOIS information via cURL, I suggest you to look into the existing API providers such as JSONWHOIS, IP2WHOIS or WHOXY.

Michael C.
  • 1,410
  • 1
  • 9
  • 20
  • Thank you for the answer. My goal is to get rid of an API (for its price or the storage of my input data that I don't want to share with an API). I tried to go through fsockopen which is more appropriate, but the daily limitations of Whois by IP (I have a lot of domain names to test per day) forces me to go through proxies. And I can't make a request to each of the Whois servers to give me unlimited access as I've seen in response sometimes. – Mikael Jan 14 '20 at 18:59
  • I've seen old questions about stackoverflow that talked about the same need as me https://stackoverflow.com/questions/12415541/php-fsocketopen-though-proxy One of the answers was to go through ProxyChains, a solution that hasn't been updated for 10 years and which apparently contains bugs... http://proxychains.sourceforge.net/ I was hoping to find a more up-to-date solution, but that doesn't seem to be the case ... What do you think about that? – Mikael Jan 14 '20 at 18:59