Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set interface (xxx.xxx.xxx.xxx) with sockets #208

Open
elnarvi opened this issue Mar 29, 2023 · 0 comments
Open

set interface (xxx.xxx.xxx.xxx) with sockets #208

elnarvi opened this issue Mar 29, 2023 · 0 comments

Comments

@elnarvi
Copy link

elnarvi commented Mar 29, 2023

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);
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant