本文整理匯總了PHP中PSU::xmlpp方法的典型用法代碼示例。如果您正苦於以下問題:PHP PSU::xmlpp方法的具體用法?PHP PSU::xmlpp怎麽用?PHP PSU::xmlpp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PSU
的用法示例。
在下文中一共展示了PSU::xmlpp方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: soapRequest
/**
* soapRequest
*
* make a SOAP request to Zimbra server, returns the XML
*
* @since version 1.0
* @param string $body body of page
* @param boolean $header
* @param boolean $footer
* @return string $response
*/
protected function soapRequest($body, $header = false, $connecting = false)
{
$this->error = $this->error_code = null;
if (!$connecting && !$this->_connected) {
throw new Exception('zimbra.class: soapRequest called without a connection to Zimbra server');
}
if ($header == false) {
$header = '<context xmlns="urn:zimbra">
<authToken>' . $this->auth_token . '</authToken>
<sessionId id="' . $this->session_id . '">' . $this->session_id . '</sessionId>
</context>';
}
$soap_message = '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header>' . $header . '</soap:Header>
<soap:Body>' . $body . '</soap:Body>
</soap:Envelope>';
$this->message(sprintf('%s SOAP message: %s', get_class($this), PSU::xmlpp($soap_message, true)));
curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $soap_message);
if (!($response = curl_exec($this->_curl))) {
$this->error = sprintf('%s ERROR: curl_exec - (%s) %s', get_class($this), curl_errno($this->_curl), curl_error($this->_curl));
if ($this->debug) {
echo '<hr>';
}
return false;
} elseif (strpos($response, '<soap:Body><soap:Fault>') !== false) {
$this->error_code = $this->extractErrorCode($response);
$this->error = sprintf('%s ERROR: %s: %s', get_class($this), $this->error_code, PSU::xmlpp($response, true));
$this->message($this->error);
if ($this->debug) {
echo '<hr>';
}
return false;
}
$this->message(sprintf('%s SOAP response: %s', get_class($this), PSU::xmlpp($response, true)));
if ($this->debug) {
echo '<hr>';
}
$this->_num_soap_calls++;
return $response;
}