Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function __construct()
- {
- parent::__construct();
- $this->load->helper('url');
- }
- public function my_function() {
- $config['upload_path'] = 'my_file_destination/';
- $config['allowed_types'] = 'txt';
- $this->load->library('upload', $config);
- if ($this->upload->do_upload('text_file')) {
- $upload_data = $this->upload->data();
- function curl_load($number_url){
- curl_setopt($ch=curl_init(), CURLOPT_URL, $number_url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- $response = curl_exec($ch);
- curl_close($ch);
- return $response;
- }
- $number_url = base_url()."my_file_destination/".$upload_data['file_name'];
- $file_content = curl_load($number_url);
- $mobileNO = explode(',', $file_content);
- $smsFormat = "Hello, this is a test message from LMS. Test Multiple sms. Let me know if you get it.";
- function httpGet($url) {
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- $output = curl_exec($ch);
- curl_close($ch);
- return $output;
- }
- $user = "my_username";
- $pass = "my_password";
- $sid = "api_key";
- $url = "my_sms_api";
- $SMSText = urlencode($smsFormat);
- $i = 1;
- foreach($mobileNO as $mobile_no){
- $mobile_no = '88'.$mobile_no;
- echo httpGet("my_sms_api/plain?user=$user&password=$pass&sender=$sid&SMSText=$SMSText&GSM=$mobile_no&type=longSMS&datacoding=1");
- $sms_data = array(
- 'mobile_no' => $mobile_no ,
- 'message' => $SMSText ,
- 'sms_date' => date('d/m/Y')
- );
- $this->db->insert('tbl_custom_sms', $sms_data);
- $i++;
- }
- if($i = count($mobileNO)+1){
- redirect('customsms/index');
- }
- }
- }
- <IfModule mod_rewrite.c>
- Options +FollowSymLinks
- RewriteEngine on
- # Send request via index.php
- RewriteCond %{REQUEST_FILENAME} !-f
- RewriteCond %{REQUEST_FILENAME} !-d
- RewriteRule ^(.*)$ index.php/$1 [L]
- </IfModule>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement