title: Php Save fopen Result To A String
body: <p>How can I get the "$buffer" value into a string, and use it outside the fopen and fclose functions? Thanks.</p>
  
  <pre><code>$handle = @fopen("http://www.example.com/", "r");
  
  if ($handle) {
      while (!feof($handle)) {
          $buffer = fgetss($handle, 5000);
  
        echo $buffer ;
      }
  
      fclose($handle);
  }
  </code></pre>