i have a script where i use die to prevent a function's continuous loop. But if i place this above the html, the html script will stop as well so i place it below the html but all the variables get echoed below the actual website. How can i make sure this get's echoed to the place where i want it to be and not below the website? Or is there a different way than using die? This is the code of the function:
function QueryWhoisServer($whoisserver, $domain) {
$port = 43;
$timeout = 5;
$errm = "<p1>No connection could be made</p1>";
$fp = @fsockopen($whoisserver, $port, $errno, $errstr, $timeout) or die($errm);
fputs($fp, $domain . "\r\n");
$out = "";
while (!feof($fp)) {
$out .= fgets($fp);
}
fclose($fp);
$res = "";
if((strpos(strtolower($out), "error") === FALSE) && (strpos(strtolower($out), "not allocated") === FALSE)) {
$rows = explode("\n", $out);
foreach($rows as $row) {
$row = trim($row);
if(($row != ':') && ($row != '#') && ($row != '%')) {
$res .= $row."<br>";
}
}
}
return $res;
}