<?php
function callback($retval, $callinfo) {
if ($callinfo == NULL) {
echo "Now, all requests are sent, and no response available\n";
} else {
echo "This is a remote call response, the method name is ", $callinfo["method"],
". calling sequence is ", $callinfo["sequence"], "\n";
var_dump($retval);
}
}
function error_callback($type, $error, $callinfo) {
error_log($error);
}
Yar_Concurrent_Client::call("http://api.example.com/operator.php", "some_method", array("parameters"), "callback");
/* if the callback is not specified, the callback of loop() will be used */
Yar_Concurrent_Client::call("http://api.example.com/operator.php", "some_method", array("parameters"));
Yar_Concurrent_Client::loop("callback", "error_callback");
?>
The above example will output
something similar to:
Now, all requests are sent, and no response available
This is a remote call response, the method name is some_method. calling sequence is 2
string(11) "some_method"
This is a remote call response, the method name is some_method. calling sequence is 1
string(11) "some_method"