Once the function is enabled (not default) in xml_functions.inc.php, this should work

This commit is contained in:
Miles Lott 2001-12-04 13:46:04 +00:00
parent ce01f617eb
commit 063e834ec5

View File

@ -22,29 +22,72 @@
$tpl_root = $phpgw_setup->setup_tpl_dir('setup');
$setup_tpl = CreateObject('phpgwapi.Template',$tpl_root);
$setup_tpl->set_file(array('T_footer' => 'footer.tpl'));
$setup_tpl->set_file(array(
'T_head' => 'head.tpl',
'T_footer' => 'footer.tpl'
));
$setup_tpl->set_block('T_footer','footer','footer');
$f = CreateObject('phpgwapi.xmlrpcmsg','system.listApps',array(CreateObject('phpgwapi.xmlrpcval',0,'int')));
print '<pre>' . htmlentities($f->serialize()) . "</pre>\n";
$c = CreateObject('phpgwapi.xmlrpc_client','/cvsdemo/xmlrpc.php','www.phpgroupware.org',80);
$host = 'us3.phpgroupware.org';
$path = '/cvsdemo/xmlrpc.php';
$phpgw_setup->show_header(lang('Application List'),True);
/* Login as demo */
$login = CreateObject(
'phpgwapi.xmlrpcmsg',
'system.login',
array(
CreateObject(
'phpgwapi.xmlrpcval',
array(
'domain' => CreateObject('phpgwapi.xmlrpcval','default','string'),
'username' => CreateObject('phpgwapi.xmlrpcval','demo','string'),
'password' => CreateObject('phpgwapi.xmlrpcval','guest','string')
),
'struct'
)
)
);
echo '<pre>' . htmlentities($login->serialize()) . "</pre>\n";
$c = CreateObject('phpgwapi.xmlrpc_client',$path,$host,80);
$c->setDebug(1);
$r = $c->send($f);
if (!$r)
{
die('send failed');
}
$r = $c->send($login);
$v = $r->value();
$result = xmlrpc_decode($v);
/* Get applist */
$f = CreateObject('phpgwapi.xmlrpcmsg','system.listApps','');
echo '<pre>' . htmlentities($f->serialize()) . "</pre>\n";
$c = CreateObject('phpgwapi.xmlrpc_client',$path,$host,80);
$c->setDebug(1);
$c->username = $result['sessionid'];
$c->password = $result['kp3'];
$r = $c->send($f);
/* Logout */
$logout = CreateObject(
'phpgwapi.xmlrpcmsg',
'system.logout',
array(
CreateObject(
'phpgwapi.xmlrpcval',
array(
'sessionid' => CreateObject('phpgwapi.xmlrpcval',$result['sessionid'],'string'),
'kp3' => CreateObject('phpgwapi.xmlrpcval',$result['kp3'],'string')
),
'struct'
)
)
);
echo '<pre>' . htmlentities($logout->serialize()) . "</pre>\n";
$c = CreateObject('phpgwapi.xmlrpc_client',$path,$host,80);
$c->setDebug(1);
$r = $c->send($logout);
$v = $r->value();
if (!$r->faultCode())
{
// print "<HR>I got this value back<BR><PRE>" .
// htmlentities($r->serialize()). "</PRE><HR>\n";
}
else
{
print 'Fault: ';
print 'Code: ' . $r->faultCode() . " Reason '" .$r->faultString()."'<br>";
}
$phpgw_setup->show_footer();
?>