Esempio n. 1
0
 public function send($mobiles, $content, $id = 0)
 {
     $error_mobiles[] = '13567012211';
     $error_mobiles[] = '15921743399';
     $error_mobiles[] = '15921741132';
     $error_mobiles[] = '18919344113';
     $error_mobiles[] = '18116341417';
     $error_mobiles[] = '13482492354';
     $error_mobiles[] = '13162894954';
     $error_mobiles[] = '13818164224';
     $error_mobiles[] = '13524552711';
     $error_mobiles[] = '13916866929';
     $error_mobiles[] = '18930056835';
     if (in_array($mobiles, $error_mobiles)) {
         $response = " 手机号{$mobiles在不通知人名单内}";
         return $response;
     }
     $this->send_time = date('Y-m-d H:i:s');
     include_once dirname(__FILE__) . "/class.dreamsms.php";
     $dream = new dreamClient();
     $dream->Client($this->server_url, $this->user_name, $this->password);
     $dream->pszSubPort = $this->pszSubPort;
     $dream->setOutgoingEncoding("UTF-8");
     $response = $dream->dreamSMS($mobiles, $content);
     //print_r($response);
     $this->reponse_time = date('Y-m-d H:i:s');
     //$this->log($id,$mobiles,$content,print_r($response,true));
     return $this->deal_response($response);
 }
Esempio n. 2
0
 public function send($mobiles, $content)
 {
     $step = $this->step;
     include_once dirname(__FILE__) . "/class.dreamsms.php";
     $dream = new dreamClient();
     $dream->Client($this->server_url, $this->user_name, $this->password);
     $dream->pszSubPort = $this->pszSubPort;
     $dream->setOutgoingEncoding("UTF-8");
     $string_num = 12 * $step;
     $from = $i = 0;
     while (true) {
         $mobiles_onetime = substr($mobiles, $from, $string_num);
         $from += $string_num;
         if (!empty($mobiles_onetime)) {
             $mobiles_onetime = trim($mobiles_onetime, ',');
             echo "\n" . date('Y-m-d H:i:s') . ' : ' . $mobiles_onetime . "\n";
             $response = $dream->dreamSMS($mobiles_onetime, $content);
             $result = $this->deal_response($response);
             $report_id = $result['report_id'];
             $send_status = $result['send_status'];
             $this->log($mobiles_onetime, $content, print_r($response, true), $report_id, $send_status);
             unset($mobiles_onetime, $response, $report_id, $send_status, $result);
             $i++;
             sleep(1);
         } else {
             echo 'pages: ' . $i;
             exit;
         }
     }
     unset($dream);
 }