/** * */ public function loadXML($response) { $valid = true; if (extension_loaded('WebServices')) { if (!is_string($response)) { $this->_fault = new Zend_XmlRpc_Fault(650); $this->_fault->setEncoding($this->getEncoding()); return false; } try { $xml = @new SimpleXMLElement($response); } catch (Exception $e) { // Not valid XML $this->_fault = new Zend_XmlRpc_Fault(651); $this->_fault->setEncoding($this->getEncoding()); return false; } if (!empty($xml->fault)) { // fault response $this->_fault = new Zend_XmlRpc_Fault(); $this->_fault->setEncoding($this->getEncoding()); $this->_fault->loadXml($response); return false; } if (empty($xml->params)) { // Invalid response $this->_fault = new Zend_XmlRpc_Fault(652); $this->_fault->setEncoding($this->getEncoding()); return false; } $value = rpc_decode($response); $this->setReturnValue($value); } else { $valid = parent::loadXML($response); } return $valid; }
/** * Decodes xmlrpc or jsonrpc to php values. * * @param string $value Value to decode * @param string $encoding (optional) The encoding of the charset (ex: 'utf-8') * @return mixed Decoded php value */ public static function rpcDecode($value, $encoding = null) { return rpc_decode($value, $encoding); }