Esempio n. 1
0
 /**
  * Cronjob that sends SMS Text messages with forecast info
  *
  * @access public
  * @return void
  */
 public function smsForecast()
 {
     log_message('error', 'Starting SMS service');
     log_message('error', 'Gathering users...');
     $sId = TWILIO_SID;
     $token = TWILIO_TOKEN;
     $twilio = new Services_Twilio($sId, $token);
     $smsClients = new Smsclient();
     $clients = $smsClients->load();
     $number = TWILIO_NUMBER;
     foreach ($clients as $client) {
         $content = file_get_contents('http://wap.weather.fi/peek?param1=' . $client->getLocation() . '&lang=en&format=text1');
         $twilio->account->messages->sendMessage($number, $client->getNumber(), $content);
         log_message('error', 'SMS send to ' . $client->getNumber());
     }
     log_message('error', 'Finished the SMS service');
     exit;
 }
Esempio n. 2
0
 /**
  * Displays all sms clients
  *
  * @access public
  * @return void
  */
 public function index()
 {
     $client = new Smsclient();
     $this->data["clients"] = $client->load();
     $this->load->view("smsclients/index", $this->data);
 }