本文整理汇总了PHP中LogHelper::saveCatLogSubscribe方法的典型用法代码示例。如果您正苦于以下问题:PHP LogHelper::saveCatLogSubscribe方法的具体用法?PHP LogHelper::saveCatLogSubscribe怎么用?PHP LogHelper::saveCatLogSubscribe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogHelper
的用法示例。
在下文中一共展示了LogHelper::saveCatLogSubscribe方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendEmails
static function sendEmails(array $subscribeUzUserGroups, $messageSubject, $messageText, $subscribesUzGroup = 0)
{
if (!empty(Yii::app()->params["SubscribesUz"]) && sizeof($subscribeUzUserGroups) > 0) {
// Данные которые предостовляет Subscribes.uz
$SubscribesUzHash = Yii::app()->params["SubscribesUz"]["hash"];
$SubscribesUzUserEmail = Yii::app()->params["SubscribesUz"]["userEmail"];
$subscribesUzGroup = $subscribesUzGroup > 0 ? $subscribesUzGroup : Yii::app()->params["SubscribesUz"]["group"];
// Данные которые предостовяет пользователь
$listUserGroups = implode("-", $subscribeUzUserGroups);
$messageSubject = trim($messageSubject);
$messageText = trim($messageText);
if (sizeof($listUserGroups) && !empty($messageSubject) && !empty($messageText)) {
$userHash = substr(md5(md5($SubscribesUzUserEmail . $SubscribesUzHash) . date("Y-m-d H")), 0, 15);
$messageText = str_replace(array("?", "&", "description"), array("@v;", "@a;", "@desc;"), $messageText);
$postFields = "message-user-groups=" . $listUserGroups . "&message-subject=" . $messageSubject . "&message-text=" . $messageText;
$postFields .= "&user-email=" . $SubscribesUzUserEmail . "&hash=" . $userHash . "&group=" . $subscribesUzGroup;
// echo $postFields;
$url = Yii::app()->params["SubscribesUz"]["url"] . "addqueue";
//echo $url."<br/>";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
// set url to post to
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// return into a variable
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
// times out after 4s
curl_setopt($ch, CURLOPT_POST, 1);
// set POST method
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
// add POST fields
$result = curl_exec($ch);
// run the whole process
curl_close($ch);
if ($result === FALSE) {
echo "cURL Error: " . curl_error($ch);
} else {
echo $result;
// Логируем
LogHelper::saveCatLogSubscribe();
return true;
}
//echo $result;
}
} else {
throw new ExceptionClass('Error SubscribesUz: Не указанны данные для подключения');
}
return false;
}