本文整理汇总了PHP中Zend_XmlRpc_Response::getResult方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_XmlRpc_Response::getResult方法的具体用法?PHP Zend_XmlRpc_Response::getResult怎么用?PHP Zend_XmlRpc_Response::getResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_XmlRpc_Response
的用法示例。
在下文中一共展示了Zend_XmlRpc_Response::getResult方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: call
/**
* Send an JSON-RPC request to the service (for a specific method)
*
* @param string $method Name of the method we want to call
* @param array $params Array of parameters for the method
* @return mixed
* @throws Zend_Json_Client_FaultException
*/
public function call($method, $params = array())
{
if (!$this->skipSystemLookup() && !empty($method)) {
$signature = $this->getIntrospector()->getMethodSignature($method);
foreach ($params as $key => $param) {
if (is_int($key)) {
// positional parameters
// can't validate them
continue;
}
$keyFound = false;
foreach ($signature["parameters"] as $parameter) {
if ($parameter['name'] == "{$key}") {
$keyFound = true;
}
}
if ($keyFound !== true) {
throw new Zend_Json_Client_FaultException("named parameter {$key} not found in SMD");
}
}
}
$request = new Zend_Json_Server_Request();
$request->setVersion('2.0');
$request->setId(1);
$request->setMethod($method);
$request->setParams($params);
$this->doRequest($request);
if ($this->_lastResponse->isError()) {
$fault = $this->_lastResponse->getError();
/**
* Exception thrown when an JSON-RPC fault is returned
* @see Zend_Json_Client_FaultException
*/
require_once 'Zend/Json/Client/FaultException.php';
throw new Zend_Json_Client_FaultException($fault->getMessage(), $fault->getCode());
}
return $this->_lastResponse->getResult();
}