0

I want to use a proxy with authentication to my below code to communicate and get data from whois servers.

My code is as follows:

$whoisserver = "whois.verisign-grs.com";
$port = 43;
$timeout = 10;

$fp = @fsockopen($whoisserver, $port, $errno, $errstr, $timeout) or die("Socket Error " . $errno . " - " . $errstr);

fputs($fp, $domain . "\r\n");
$out = "";
while(!feof($fp)){
    $out .= fgets($fp);
}
fclose($fp);

In the above I want to use a username and password to authenticate my proxy.

What do I change in the code above to achieve my desired outcome?

  • Could you clarify the question, please? Are you writing the proxy server? Which part of the system requires authentication? – Oliver Crow May 20 '20 at 21:42
  • i want to make requests with proxy server and my proxy server needs authentication to make requests from it. And using fsockopen i dont know how to use proxy and make request to the domain whois servers. – Sudheer Ankireddypalli May 21 '20 at 04:07
  • Are you saying that the proxy server is making requests to a whois server and that the proxy server must authenticate itself to the whois server? – Oliver Crow May 21 '20 at 19:07
  • no proxy server needs authentication from my end to process further connection to whois server. you can also tell me how to use proxy without authentication because i can setup my proxy and whitelist my ip instead of using authentication. But i prefer proxy with authentication. – Sudheer Ankireddypalli May 21 '20 at 19:20
  • so i mean to say that to connect to my proxy i need to use authentication(username and password) to make further requests to whois server. hope i dint confuse you. – Sudheer Ankireddypalli May 21 '20 at 19:29
  • What software are you using at "my end" – what connects to the proxy? – Oliver Crow May 22 '20 at 20:44
  • Instead of whois, I recommend you have a look at RDAP, its "successor". Since it is JSON over HTTPS it is far easier to make it work with HTTP proxies. Whois is not a protocol using HTTP (it was invented far before it) and hence there are no "whois proxies". – Patrick Mevzek May 28 '20 at 00:33

0 Answers0