xmlrpc_server_call_method() with class methods
{header('Content-Type: text/xml');
echo$response;
}// **************** class definition ****************classexternal_report{
protected$db_connection;
public function__construct($db_connection_pointer)
{
if (method_exists($db_connection_pointer,"Execute"))$this->db_connection=$db_connection_pointer;
else die("...");
}
public functionexport($method_name,$params_array)
{$id_dir= (int)$params_array[0];$id_usr= (int)$params_array[1];// not used, just an example
// We have to add arguments' validating code here and NOT inside the constructor (as usual)
// because arguments are passed directly by xmlrpc_server_call_method (?!!)$myexport= array();$dirs_query="SELECT documento_id FROM tabella_cartelle WHERE cartella_id = ".$id_dir;$dirs_result=$this->db_connection->Execute($dirs_query) or die("...");$index=0;
while(!$dirs_result->EOF)
{$docs_query="SELECT codice, titolo FROM tabella_documenti WHERE id_documento = ".$dirs_result->Fields('documento_id');$docs_result=$this->db_connection->Execute($docs_query) or die("...");$myexport[$index]['codice'] =$docs_result->Fields('codice');$myexport[$index]['titolo'] =$docs_result->Fields('titolo');$index++;$dirs_result->MoveNext();
}
return$myexport;
}
}?>