Foros del Web » Programando para Internet » PHP »

duda en error con xml

Estas en el tema de duda en error con xml en el foro de PHP en Foros del Web. saludos tengo esto echo @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); Código PHP: Ver original <?php     //file_put_contents('files/config.opml', $opml);     require ( "../config.php" ) ;     require ...
  #1 (permalink)  
Antiguo 01/07/2015, 09:41
 
Fecha de Ingreso: junio-2012
Ubicación: En el Mundo
Mensajes: 759
Antigüedad: 11 años, 10 meses
Puntos: 10
duda en error con xml

saludos tengo esto echo
Código PHP:
Ver original
  1. <?php
  2.     //file_put_contents('files/config.opml', $opml);
  3.     require("../config.php");
  4.     require("../functions/cmum.php");
  5.     header("Content-type: text/xml; charset=".$charset);
  6.     print("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n");
  7.     $id = $_GET["id"];
  8.    
  9.         $mysqli=new mysqli($dbhost,$dbuser,$dbpass,$dbname);
  10.             $sql_st=$mysqli->query("SELECT * FROM streaming WHERE enabled='1' AND SubCategory ='".$id."'");
  11.  
  12.            while($res_st=$sql_st->fetch_array()) {
  13.           print("<channel>\n");
  14.           print("<title/>\n");
  15.           print("<description/>\n");
  16.           print("<item>\n");
  17.           print("<id>".$res_st["id"]."</id>\n");
  18.           print("<title>".$res_st["Title"]."</title>\n");
  19.           print("<description>".$res_st["Description"]."</description>\n");
  20.           print("<duration>".$res_st["Duration"]."</duration>\n");
  21.           print("<thumbnail url=\"http://".$setres["srv_ip"]."/".$res_st["SelectImage"]."\"/>\n");
  22.           if($res_st["Format"] == "hls"){
  23.           print("<content url=\"".$res_st["StreamingUrl"]."\" height=\"hls\"/>\n");
  24.           }elseif($res_st["Format"] == "mp4"){
  25.           print("<content url=\"".$res_st["StreamingUrl"]."\" height=\"720p\"/>\n");
  26.           }elseif($res_st["Format"] == "mp3"){
  27.           print("<content url=\"".$res_st["StreamingUrl"]."\" height=\"mp3\"/>\n");
  28.           }
  29.           print("</item>\n");
  30.           print("</channel>\n");
  31.           print("</rss>\n");
  32.            }
  33.  
  34.  
  35. ?>

pero me esta tirando error

XML Parsing Error: not well-formed
Location: http://192.168.20.102/cmum/tools/all.php?id=6
Line Number 16, Column 2:
</rss>
-^
  #2 (permalink)  
Antiguo 01/07/2015, 11:20
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: duda en error con xml

Pues es obvio, ¿en qué parte es que abres <rss> para luego cerrar </rss> eh?
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #3 (permalink)  
Antiguo 01/07/2015, 18:00
 
Fecha de Ingreso: junio-2012
Ubicación: En el Mundo
Mensajes: 759
Antigüedad: 11 años, 10 meses
Puntos: 10
Respuesta: duda en error con xml

Código PHP:
Ver original
  1. <?php
  2.     //file_put_contents('files/config.opml', $opml);
  3.     require("../config.php");
  4.     require("../functions/cmum.php");
  5.     header("Content-type: text/xml; charset=".$charset);
  6.     print("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n");
  7.     $id = $_GET["id"];
  8.    
  9.         $mysqli=new mysqli($dbhost,$dbuser,$dbpass,$dbname);
  10.             $sql_st=$mysqli->query("SELECT * FROM streaming WHERE enabled='1' AND SubCategory ='".$id."'");
  11.  
  12.            while($res_st=$sql_st->fetch_array()) {
  13.           print("<rss>\n");
  14.           print("<channel>\n");
  15.           print("<title/>\n");
  16.           print("<description/>\n");
  17.           print("<item>\n");
  18.           print("<id>".$res_st["id"]."</id>\n");
  19.           print("<title>".$res_st["Title"]."</title>\n");
  20.           print("<description>".$res_st["Description"]."</description>\n");
  21.           print("<duration>".$res_st["Duration"]."</duration>\n");
  22.           print("<thumbnail url=\"http://".$setres["srv_ip"]."/".$res_st["SelectImage"]."\"/>\n");
  23.           if($res_st["Format"] == "hls"){
  24.           print("<content url=\"".$res_st["StreamingUrl"]."\" height=\"hls\"/>\n");
  25.           }elseif($res_st["Format"] == "mp4"){
  26.           print("<content url=\"".$res_st["StreamingUrl"]."\" height=\"720p\"/>\n");
  27.           }elseif($res_st["Format"] == "mp3"){
  28.           print("<content url=\"".$res_st["StreamingUrl"]."\" height=\"mp3\"/>\n");
  29.           }
  30.           print("</item>\n");
  31.           print("</channel>\n");
  32.           print("</rss>\n");
  33.            }
  34.  
  35.  
  36. ?>

Etiquetas: mysql, select, sql, xml
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 21:53.