title: Send php variable to above for preventing a loop
body: <p>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:</p>
  
  <pre><code>function QueryWhoisServer($whoisserver, $domain) {
      $port = 43;
      $timeout = 5;
      $errm = "&lt;p1&gt;No connection could be made&lt;/p1&gt;";
      $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) &amp;&amp; (strpos(strtolower($out), "not allocated") === FALSE)) {
          $rows = explode("\n", $out);
          foreach($rows as $row) {
              $row = trim($row);
              if(($row != ':') &amp;&amp; ($row != '#') &amp;&amp; ($row != '%')) {
                  $res .= $row."&lt;br&gt;";
              }
          }
      }
      return $res;
  }
  </code></pre>