1
Running QueueMetrics / Re: XML-RPC - problems using the QM.realtime method
« on: June 21, 2007, 10:59:57 »Yes!! now works perfect!
Thanks
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
<h1>A QueueMetrics XML-RPC client in PHP</h1>
<?
require_once 'XML/RPC.php';
$qm_server = "192.168.254.164"; // the QueueMetrics server address
$qm_port = "8080"; // the port QueueMetrics is running on
$qm_webapp = "queuemetrics/qm"; // the webapp name for QueueMetrics
//llamadas en curso
$req_blocks_rt = new XML_RPC_Value(array(
new XML_RPC_Value("RealtimeDO.RTRiassunto"),
new XML_RPC_Value("RealtimeDO.RTCallsBeingProc")
), "array");
// general invocation parameters - see the documentation
$params_rt = array(
new XML_RPC_Value("9"),
new XML_RPC_Value("robot"),
new XML_RPC_Value("robot"),
new XML_RPC_Value(""),
new XML_RPC_Value(""),
new XML_RPC_Value(""),
$req_blocks_rt
);
$msg_rt = new XML_RPC_Message('QM.rt', $params_rt);
$cli_rt = new XML_RPC_Client("/$qm_webapp/xmlrpc.do", $qm_server,$qm_port);
$cli_rt->setDebug(1);
$resp_rt = $cli_rt->send($msg_rt);
if (!$resp_rt) {
echo 'Communication error: ' . $cli_rt->errstr;
exit;
}
if ($resp_rt->faultCode()) {
echo 'Fault Code: ' . $resp_rt->faultCode() . "\n";
echo 'Fault Reason: ' . $resp_rt->faultString() . "\n";
} else {
$val_rt = $resp_rt->value();
$blocks_rt = XML_RPC_decode($val_rt);
// now we print out the details....
printBlock( "result", $blocks_rt );
printBlock( "RealtimeDO.RTRiassunto", $blocks_rt );
}
// output a response block as HTML
function printBlock( $blockname, $blocks ) {
echo "<h2>Response block: $blockname </h2>";
echo "<table border=1>";
$block = $blocks[$blockname];
for ( $r = 0; $r < sizeof( $block ); $r++ ) {
echo "<tr>";
for ( $c = 0; $c < sizeof( $block[$r] ); $c++ ) {
echo( "<td>" . $block[$r][$c] . "</td>" );
}
echo "</tr>\n";
}
echo "</table>";
}
?>