本文整理匯總了PHP中Zend_XmlRpc_Response::getError方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_XmlRpc_Response::getError方法的具體用法?PHP Zend_XmlRpc_Response::getError怎麽用?PHP Zend_XmlRpc_Response::getError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_XmlRpc_Response
的用法示例。
在下文中一共展示了Zend_XmlRpc_Response::getError方法的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();
}