<?php require_once "../conf.php"; require_once _TWITTER_CLASS_PATH . "Mail.php"; $alert_mail_add = array('*****@*****.**'); $subject = "テスト2"; $body = "テストてすとtest2"; Alert_Mail::sendAlertMail($alert_mail_add, $subject, $body);
private function getTargetUser() { $TagetUsers = array(); $ActiveUser = array(); $NonActiveUser = array(); $sql = "SELECT target_user_id, target_screen_name FROM dt_follower_target WHERE account_id = ?"; $res = $this->DBobj->query($sql, array($this->Account_ID)); foreach ($res as $rec) { $cursor = null; for ($i = 0; $i < 20; $i++) { $option = array('screen_name' => $rec->target_screen_name, 'stringify_ids' => true, 'count' => 5000); if (!is_null($cursor)) { $option['cursor'] = $cursor; } $FollowersIds_obj = new followers_ids($this->twObj); $api_res = $FollowersIds_obj->setOption($option)->Request(); //エラーチェック $apiErrorObj = new Api_Error($api_res); if ($apiErrorObj->error) { throw new Exception($apiErrorObj->errorMes_Str); } unset($apiErrorObj); foreach ($api_res->ids as $user_id) { if ($this->checkAlreadyFollowing($user_id)) { $TagetUsers[] = $user_id; } if (count($TagetUsers) >= $this->Follow_Num_Inday) { //アクティブ抽出処理 list($actives, $nonacs) = $this->checkActiveUser($TagetUsers); $NonActiveUser = array_merge($NonActiveUser, $nonacs); foreach ($actives as $active) { array_push($ActiveUser, $active); if (count($ActiveUser) >= $this->Follow_Num_Inday) { //ターゲット取得完了 $mes = date("Y-m-d H:i:s") . " フォローターゲット取得ループ数: " . ($i + 1) . "回 \n"; error_log($mes, 3, _TWITTER_LOG_PATH . $this->logFile); return array($ActiveUser, $NonActiveUser); } } $TagetUsers = array(); } } if (isset($api_res->next_cursor) and $api_res->next_cursor > 0) { $cursor = $api_res->next_cursor; } else { break; } } } //ターゲット枯渇 $mes = "フォローターゲットが枯渇しました。新たなターゲットを設定してください。\n"; $sql = "INSERT INTO dt_message ( account_id, type, message1, check_flg, create_date) VALUES ( ?, ?, ?, 0, now())"; $res = $this->DBobj->execute($sql, array($this->Account_ID, $this->alert_mes_type, $mes)); error_log($mes, 3, _TWITTER_LOG_PATH . $this->logFile); //メール送信 $subject = 'アカウント:' . $this->AccountInfo->notice; Alert_Mail::sendAlertMail($this->alert_mail_add, $subject, $mes); return $TagetUsers; }