Explain pliz purpose of the while loop in the function code, I understand that there is a check at the end of the file, but why in the loop, what is not done? was it easier to do an if check? thanks in advance

function whois($domain) { echo $domain; $whoisdom='whois.nic.ru'; // $ask=fsockopen($whoisdom, 43, $errno, $errstr, 30); if(!isset($ask)) { $respons = "$errstr ($errno)"; } else { $respons=""; fputs($ask, "$domain\r\n"); while(!feof($ask)) $respons .=fread($ask, 1500); fclose($ask); } //$respons=str_replace("\n", "<br/>", $respons); return $respons; } $a=whois("vk.com"); echo $a; 
  • While the file is not finished, read and scroll further. I think that is so clear) Work is not the end. - Masha Malevich

1 answer 1

The body of the loop is the line $respons .=fread($ask, 1500);

The loop reads to the end of the $respons variable the output of whois for the given domain name.

  • one
    exactly after the same vayla; not!!!!! thanks a lot looked through - Sled Sled