Simplexml load file + request to xml

Read XML From a File

data.php

$xml = simplexml_load_file('http://www.domain.com/xml.php?id=999'); /*full path of file*/
echo '<pre>';
print_r($xml);
echo '</pre>';

SimpleXMLElement + REQUEST

xml.php

header('Content-type: text/xml');
$xml_str='';
$xml_str.='<?xml version='1.0' encoding='UTF-8' ?>';
$xml_str.='<request>';
$xml_str.= '<request_id>'.$_REQUEST[id].'</request_id>';
$xml_str.='</request>';
echo $xml_str;