本文整理汇总了PHP中Preference::findOneValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Preference::findOneValue方法的具体用法?PHP Preference::findOneValue怎么用?PHP Preference::findOneValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Preference
的用法示例。
在下文中一共展示了Preference::findOneValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: subscribe
/**
* @param $providerURL Endereço do Discovery remoto
* @param $requesterNSA NSA ID do requisitante
* @param $requesterURL Endereço do Discovery local para receber notificações
*/
static function subscribe($providerURL, $requesterNSA, $requesterURL)
{
$ch = curl_init();
$message = '<?xml version="1.0" encoding="UTF-8"?><tns:subscriptionRequest ' . 'xmlns:tns="http://schemas.ogf.org/nsi/2014/02/discovery/types">' . '<requesterId>urn:ogf:network:' . Preference::findOneValue(Preference::MEICAN_NSA) . '</requesterId>' . '<callback>' . Url::toRoute("/topology/discovery/notification", "http") . '</callback>' . '<filter>' . '<include>' . '<event>All</event>' . '</include>' . '</filter>' . '</tns:subscriptionRequest>';
$options = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_POST => 1, CURLOPT_POSTFIELDS => $message, CURLOPT_HTTPHEADER => array('Accept-encoding: application/xml;charset=utf-8', 'Content-Type: application/xml;charset=utf-8'), CURLOPT_USERAGENT => 'Meican', CURLOPT_URL => $providerURL . '/subscriptions');
curl_setopt_array($ch, $options);
Yii::trace($message);
$output = curl_exec($ch);
Yii::trace($output);
curl_close($ch);
$parser = new NSIParser();
$parser->loadXml($output);
$parser->parseSubscriptions();
foreach ($parser->getData()['subs'] as $subId => $sub) {
return (string) $subId;
}
}