예제 #1
0
 function sendSMS($msgdata)
 {
     $reg_id = parent::registerSMS($msgdata);
     $data = array("key" => $this->api_key, "countrycode" => "BD", "numbers" => $msgdata['to'], "message" => urlencode($msgdata['msg']));
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, "http://bulksms.synergyinterface.com/sms_db/bulk_send_api.php");
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: multipart/form-data'));
     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
     $response = curl_exec($ch);
     curl_close($ch);
     if ($this->debug) {
         echo 'DEBUG:[' . $response . ']';
     }
     $result = json_decode($response);
     if ($result->return == 'true') {
         $status = 1;
     } else {
         $status = 0;
     }
     parent::changeStatus($reg_id, $status);
     return $status;
 }
예제 #2
0
 function sendSMS($msgdata)
 {
     $reg_id = parent::registerSMS($msgdata);
     $api = 'http://portals.bd.airtel.com/msdpapi?REQUESTTYPE=SMSSubmitReq&USERNAME='******'&PASSWORD='******'&MOBILENO=';
     $api .= $msgdata['to'] . '&MESSAGE=' . urlencode($msgdata['msg']);
     $api .= '&TYPE=0&ORIGIN_ADDR=' . urlencode(isset($msgdata['from']) ? $msgdata['from'] : $this->from);
     $response = file_get_contents($api);
     if ($this->debug) {
         echo 'DEBUG:[' . $response . ']';
     }
     if (preg_match('/Accepted/', $response)) {
         $status = 1;
     } else {
         $status = 0;
     }
     parent::changeStatus($reg_id, $status);
     return $status;
 }