Re: Read a XML (not a file)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jônatas Zechim wrote:
> Hi there, i want do read a XML like this:
> 
> Server.php
> <?php
> 
>   header ("content-type: text/xml");
> 
> echo "<?xml version=\"1.0\" encoding=\"iso-5718\" ?> <images>  <image>
>   <ID>1</ID>
>    <album>teste<album>
>    <path>/images/teste.jpg</path>
>  </image>
> </images>";
> ?>
> 
> How can do this?
> 
> zechim
> 
> 

test.php
<?php

# Capture original content-type
$contentType = ini_get('default_mimetype');

ob_start();
include 'server.php';
$xml = ob_get_contents();
ob_end_clean();

# Reset content-type of previous type
header("content-type: ".$contentType);

echo $xml;

?>

mind you that the header() call within the include is going to change the default headers(), so be sure to reset the content-type one you come out of
the include file.


-- 
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux