Advertisement
Guest User

Untitled

a guest
Jul 11th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. public function sendBulkSms() {
  2. $config['upload_path'] = 'bulk_sms/';
  3. $config['allowed_types'] = 'txt';
  4. $this->load->library('upload', $config);
  5. if ($this->upload->do_upload('text_file')) {
  6. $upload_data = $this->upload->data();
  7. //------------------send sms---------------
  8. $file_content = file_get_contents(base_url()."bulk_sms/".$upload_data['file_name']);
  9. $mobileNO = explode(',', $file_content);
  10. //$mobileNO = array("8801670750680", "8801942762160");
  11. $smsFormat = "Hi, this is a test message";
  12.  
  13. function httpGet($url) {
  14. $ch = curl_init();
  15. curl_setopt($ch, CURLOPT_URL, $url);
  16. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  17.  
  18. $output = curl_exec($ch);
  19. curl_close($ch);
  20. return $output;
  21. }
  22.  
  23. $user = "aclandctg";
  24. $pass = "CTgAcLAnd87%23_";
  25. $sid = "8804445650490";
  26. $url = "my_sms_api_url";
  27. $SMSText = urlencode($smsFormat);
  28.  
  29. foreach($mobileNO as $mobile_no){
  30. echo httpGet("my_sms_api_url?user=$user&password=$pass&sender=$sid&SMSText=$SMSText&GSM=$mobile_no&type=longSMS&datacoding=1");
  31. }
  32. // -----------end send sms----------
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement