Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/10/2014, 00:49
Sr2004
 
Fecha de Ingreso: julio-2012
Mensajes: 6
Antigüedad: 12 años, 8 meses
Puntos: 0
Problema al descargar archivo

Bueno tengo un problema cuando quiero descargar el archivo recien creado.
al momento de descargar el archivo me sale como si fuera html y al final del archivo sale... con este codigo html

Que puedo hacer para que me descargue el archivo limpio recien creado, he visto y el archivo no lleva esas lineas.
Código HTML:
Ver original
  1. <!-- Hosting24 Analytics Code -->
  2. <script type="text/javascript" src="http://stats.hosting24.com/count.php"></script>
  3. <!-- End Of Analytics Code -->

Código PHP:
Ver original
  1. <?php  
  2.         $channel=$_GET['ch'];
  3.         $profile=$_GET['pf'];
  4.         $list ="http://xxx.xxx.xxx.xxx/live/ch".$channel."/"."PROFILE".$profile.".m3u8";
  5.         $file = fopen($list, "r");
  6.         $i = 0;
  7.         $o = fgets($file, 50);
  8.         if("#"!=$o[0])
  9.         {
  10.                 echo "no existe";
  11.                 return 0;
  12.         }
  13.         fclose($file);
  14.         $file = fopen($list, "r");
  15.         $bandera = true;
  16.         $name = "lista-".$channel."-".$profile.".m3u8";
  17.         $gestor = fopen("$name", "w");
  18.         while(!feof($file))
  19.         {
  20.                 $cad = fgets($file, 50);
  21.                 if("P" == $cad[0])
  22.                 {
  23.                         fwrite($gestor,"http://xxx.xxx.xxx.xxx/live/ch".$channel."/".$cad);
  24.                 }
  25.                 else
  26.                         fwrite($gestor,$cad);
  27.                        
  28.         }
  29.         fclose($file);
  30.        
  31.        
  32.         header("Content-Description: File Transfer");
  33.         header("Content-Type application/x-mpegURL ");
  34.         header('Content-Disposition: attachment; filename="lista.m3u8"');
  35.         readfile($name);
  36.         fclose($gestor);
  37.        
  38. ?>