Open elnarvi opened 1 year ago
Description To avoid blocks in the whois server we use different IPs. With curl it is possible:
` $loader = new CurlLoader();
$loader->replaceOptions([ CURLOPT_INTERFACE => xxx.xxx.xxx.xxx, CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4 ]);
$whois = Factory::get()->createWhois($loader);
Factory::get()->createWhois($loader);
With socket it is faster but it is not possible...
Example
We have had to modify the code of the file:
vendor/io-developer/php-whois/src/Iodev/Whois/Loaders/SocketLoader.php
Changing:
$handle = @fsockopen($whoisHost, 43, $errno, $errstr, $this->timeout);
By:
` $socket_context = @stream_context_create(array("socket" => array("bindto" => "xxx.xxx.xxx.xxx:0")));
$handle = @stream_socket_client($whoisHost.":43", $errno, $errstr, $this->timeout, STREAM_CLIENT_CONNECT, $socket_context); `
Description
To avoid blocks in the whois server we use different IPs. With curl it is possible:
` $loader = new CurlLoader();
$loader->replaceOptions([ CURLOPT_INTERFACE => xxx.xxx.xxx.xxx, CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4 ]);
$whois =
Factory::get()->createWhois($loader);
With socket it is faster but it is not possible...
Example
We have had to modify the code of the file:
vendor/io-developer/php-whois/src/Iodev/Whois/Loaders/SocketLoader.php
Changing:
$handle = @fsockopen($whoisHost, 43, $errno, $errstr, $this->timeout);
By:
` $socket_context = @stream_context_create(array("socket" => array("bindto" => "xxx.xxx.xxx.xxx:0")));
$handle = @stream_socket_client($whoisHost.":43", $errno, $errstr, $this->timeout, STREAM_CLIENT_CONNECT, $socket_context); `