本文整理汇总了PHP中Notice::toXml方法的典型用法代码示例。如果您正苦于以下问题:PHP Notice::toXml方法的具体用法?PHP Notice::toXml怎么用?PHP Notice::toXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notice
的用法示例。
在下文中一共展示了Notice::toXml方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
/**
* @param Notice $notice
* @return string
**/
public function send(Notice $notice)
{
$curl = curl_init();
$xml = $notice->toXml($this->configuration);
curl_setopt($curl, CURLOPT_URL, $this->configuration->get('apiEndPoint'));
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_TIMEOUT, $this->configuration->get('timeout'));
curl_setopt($curl, CURLOPT_POSTFIELDS, $xml);
curl_setopt($curl, CURLOPT_HTTPHEADER, $this->headers);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
// HTTP proxy support
$proxyHost = $this->configuration->get('proxyHost');
$proxyUser = $this->configuration->get('proxyUser');
if (null !== $proxyHost) {
curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $this->configuration->get('proxyPort'));
if (null !== $proxyUser) {
curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUser . ':' . $this->configuration->get('proxyPass'));
}
}
$return = curl_exec($curl);
curl_close($curl);
return $return;
}
示例2: send
/**
* @param Notice $notice
* @return string
**/
public function send(Notice $notice)
{
$xml = $notice->toXml($this->configuration);
$opts = array('http' => array('method' => 'POST', 'header' => $this->headers, 'content' => $xml));
$context = stream_context_create($opts);
$result = file_get_contents($this->configuration->apiEndPoint, false, $context);
return $result;
}
示例3: send
/**
* @param Airbrake\Notice $notice
* @return string
**/
public function send(Notice $notice)
{
$curl = curl_init();
$xml = $notice->toXml($this->configuration);
curl_setopt($curl, CURLOPT_URL, $this->configuration->apiEndPoint);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_TIMEOUT, $this->configuration->timeout);
curl_setopt($curl, CURLOPT_POSTFIELDS, $xml);
curl_setopt($curl, CURLOPT_HTTPHEADER, $this->headers);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$return = curl_exec($curl);
curl_close($curl);
return $return;
}