title: Readfile() with warning error and html_entity_decode() not working - PHP
body: <p>Im trying to use php for download a file from a ssh server. The download is working but i got a warning with my function readfile() and the characters keep in html style while i use this function html_entity_decode().</p>
  
  <p>If i try this :<code>var_dump($output)</code> it gives me something like this string(xxx)" ". A string with xxx characters but empty.</p>
  
  <p>The error : </p>
  
  <pre><code>&lt;b&gt;Warning&lt;/b&gt;:  readfile(&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&amp;lt;ResultatPEC xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema- instance&amp;quot; dateCreation=&amp;quot;02-12-2018&amp;quot; versionFichier=&amp;quot;0000842887&amp;quot; xsi:noNamespaceSchemaLocation=&amp;quot;Resultats_PEC_2.10.xsd&amp;quot;&amp;gt;
  &amp;lt;IdentificationDepot CodeOffre=&amp;quot;0&amp;quot; CodeSiteDepot=&amp;quot;932930&amp;quot; DateDepot=&amp;quot;26-11-2018&amp;quot; HeureDepot=&amp;quot;07:04&amp;quot; IDDeposant=&amp;quot;590226&amp;quot; NiveauService=&amp;quot;E&amp;quot; NumDepot=&amp;quot;BR099441&amp;quot; NumeroBip=&amp;quot;0000793653&amp;quot; NumSTP=&amp;quot;21787924&amp;quot; OptionDateDepot=&amp;quot;DepotJourCreux&amp;quot; OptionMeca=&amp;quot;0&amp;quot; OptionSiteDepot=&amp;quot;Standard&amp;quot; TypeDeclaration=&amp;quot;DEPOT&amp;quot; ZoneDense=&amp;quot;1&amp;quot;/&amp;gt;
    &amp;lt;Publication IDPCD=&amp;quot;1174646&amp;quot; NoPublication=&amp;quot;0520K87314&amp;quot; NoParution=&amp;quot;391&amp;quot; NoParutionConstate=&amp;quot;391&amp;quot; PublicationPanelisee=&amp;quot;0&amp;quot; TypeParution=&amp;quot;NUM&amp;quot; TypeParutionConstate=&amp;quot;NUM&amp;quot;&amp;gt;
       in &lt;b&gt;D:\www\SAGAPEC\application\modules\supervision\controllers\AdminController.php&lt;/b&gt; on line &lt;b&gt;397&lt;/b&gt;&lt;br /&gt;
  </code></pre>
  
  <p>My code :</p>
  
  <pre><code>$connection = ssh2_connect($this-&gt;_configFile-&gt;ftp-&gt;hostname, $this-&gt;_configFile-&gt;ftp-&gt;port);
          if ($connection) {
              $login = ssh2_auth_password($connection, $this-&gt;_configFile-&gt;ftp-&gt;login, $this-&gt;_configFile-&gt;ftp-&gt;password);
              if ($login) {
                  $content = true;
                  if ($content) { 
                      $fileName = $this-&gt;_getParam('name');
                      if ($fileName){ 
                          $stream = ssh2_exec($connection, "cat {$fileName}");
                          stream_set_blocking($stream, true);
                          $output = stream_get_contents($stream);
                          simplexml_load_string($output); 
                          $abc = html_entity_decode($output,ENT_QUOTES,"UTF-8");
  
                          $file = $abc; 
  
                          header("Content-Description: File Transfer"); 
                          header("Content-Type: application/octet-stream"); 
                          header('Content-Transfer-Encoding: binary');
                          header("Content-Disposition: attachment; filename=" . basename($file)); 
  
                          readfile($file);
                          exit(); 
                      }
  </code></pre>