本文整理汇总了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;
}