But the 'server.php' is on another Server, i did this and is ok now. function ctalk_fopen($u){ $b=parse_url($u); $h=$b['host']; $p=(isset($b['query']))?$b['path']."?".$b['query']:$b['path']; $s=socket_create(AF_INET,SOCK_STREAM,0); socket_set_block($s); $r=socket_connect($s,gethostbyname($h),getservbyname('www','tcp')); $i="GET $p HTTP/1.1\r\nHost: $h\r\nConnection: close\r\n\r\n"; socket_write($s,$i,strlen($i)); $r=''; while($o=socket_read($s,4096)){$r=$r.$o;} socket_close($s); $c=preg_split("/\r?\n\r?\n/", $r,2); return $c[1]; } $u = "http://localhost/xml/server.php"; function ctalk_se($xp,$a){global $f;} function ctalk_ee($xp,$n){global $f,$i;$k=$n;$f[$k]=$i;$i="";} function ctalk_dt($xp,$d){global $i;$i.=$d;} $xp=xml_parser_create(); xml_set_element_handler($xp,"ctalk_se","ctalk_ee"); xml_set_character_data_handler($xp,"ctalk_dt"); xml_parse($xp,ctalk_fopen($u),true); print_r($f); returns an array of the XML that server.php had output. Zechim -----Mensagem original----- De: Jim Lucas [mailto:lists@xxxxxxxxx] Enviada em: sexta-feira, 6 de fevereiro de 2009 14:39 Para: Jônatas Zechim Cc: php-general@xxxxxxxxxxxxx Assunto: Re: Read a XML (not a file) 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