How do I implement proxy authentication with fsockopen in PHP?

302 Views Asked by At

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?

0

There are 0 best solutions below