PHP : select (return XML)

Esempio select con ritorno di tipo XML

<?php

/*
	select.php
	return OK<record>nr.record<record>DataResult
*/

require_once('call_class.php');
$call = new call_class();
/*
	result : XML
*/
echo "<br /><br />Result : XML : <br />";
$call->cmd = "
<record>
	<Stmt>select</Stmt>
	<Field>col_idtable, col_user, col_idkey, col_key, col_value,col_file</Field>
	<Where>col_user=?</Where>
	<ParamW>User_1</ParamW>
	<Order>col_user, col_key</Order>
	<OtherCmd>limit 100</OtherCmd>
	<ReturnSelect>XML</ReturnSelect>
	<QueryType>TABLE</QueryType>
	<ReturnFile>FILEURL</ReturnFile>
</record>
";
$Res = $call->call_curl();
if ( substr($Res, 0, 4) != "#ERR" ) {
	echo $Res;
	file_put_contents("x.xml", $Res);
}else{
	echo "error in Select_xml...".$Res;
}
return;

?>
Ritorna :
<?xml version="1.0"?>
<data>
<col_idtable>2</col_idtable>
<col_user>User_1</col_user>
<col_idkey>1</col_idkey>
<col_key>birthday</col_key>
<col_value>1966-04-30</col_value>
<col_file> </col_file>
<col_idtable>3</col_idtable>
<col_user>User_1</col_user>
<col_idkey>1</col_idkey>
<col_key>city</col_key>
<col_value>New York</col_value>
<col_file> </col_file>
<col_idkey>1</col_idkey>
<col_user>User_1</col_user>
<col_key>name</col_key>
<col_value>Tom</col_value>
<col_file> </col_file>
<col_idtable>5</col_idtable>
<col_user>User_1</col_user>
<col_idkey>1</col_idkey>
<col_key>photo</col_key>
<col_value>photo_tom.jpg</col_value>
<col_file>http://localhost/api1.dataindb/users/user_3/files/P2_5_photo_tom.jpg</col_file>
<col_idtable>4</col_idtable>
<col_user>User_1</col_user>
<col_idkey>1</col_idkey>
<col_key>text_file</col_key>
<col_value>sample.txt</col_value>
<col_file>http://localhost/api1.dataindb/users/user_3/files/P2_4_sample.txt</col_file>
</data>