Principal


Encabezado XML en PHP, como enviar xml a travez de php

****+ (4.25)
views: 1237

Para generar un archivo XML a traves de php hay que cambiar las cabeceras antes de imprimir el archivo , esto se logra agregando las siguientes lineas antes de la impresion del xml, luego simplemente usar print para imprimir el cuerpo xml.

Encabezado XML en PHP

<?php
header("Content-Type: text/xml");
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 01 Jan 2009 01:00:00 GMT");
?>

Para generar xml en otros lenguajes de scripting , aqui pueden ver el código

Encabezado XML en Perl

#!/usr/bin/perl -l
print "Content-Type: text/xml";
print "Cache-Control: no-cache, must-revalidate";
print "Expires: Mon, 01 Jan 2009 01:00:00 GMT";

Encabezado XML en ASP

<%
response.ContentType="text/xml"
response.CacheControl="no-cache, must-revalidate"
response.Expires="Mon, 01 Jan 2009 01:00:00 GMT"
%>

Encabezado XML en JSP

<%
response.setHeader("Content-Type", "text/xml");
response.setHeader("Expires", "Mon, 01 Jan 2009 01:00:00 GMT");
response.setHeader("Cache-Control", "must-revalidate");
response.setHeader("Cache-Control", "no-cache");
%>

 


Cómo Calificas este artículo?:
1 2 3 4 5


Los que entraron en este post también vieron:


Comentarios:

 vecaharris dice:
Esta bien gracias
2009-08-06
 diego dice:
muy buen articulo
2011-07-05
 Gracias amigooo dice:
Que barbaro!! no tiene precedentes lo que acabo de ver!! no sabes cuanto me ayudo tu post!!! Muchisisisismas graXXx
2011-08-15
sphairo_529@hotmail.com

Agregar Comentario:


Nombre:                       Valoración:
Comentario:
E-mail:(opcional)

Copie el texto: