本文整理匯總了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;
}