Welcome Guest, Not a member yet? Register   Sign In
Few questions for sending sms - HELP needed :(
#1

[eluser]cinewbie81[/eluser]
Code:
class Smsmessage extends Globalsetting {
    function Smsmessage()
      {
        // Load anything neccessary here
      }

      function SendMessage()
      {
            $execUrl = 'wget -b '.base_url().'index.php/sendsmsbackground/process';
            exec($execUrl);
      }
}


class Sendsmsbackground extends Globalsetting {

     function Sendsmsbackground()
      {

      }

      function process()
      {
            $customerCount = $this->GetCustomerCount();
            for ($i=0; $i<$customerCount; $i++) {
                $customerNumber = $this->GetCustomerPhoneNumber();
                $this->SendSMS($customerNumber);
            }
      }
}

The code above will use to send the sms to all customers from the database. I have few questions as following:

1)
Code:
$execUrl = 'wget -b '.base_url().'index.php/sendsmsbackground/process';
My friend ask me, why you use wget? Why dont you use curl instead?
My question is - Why curl when wget works perfectly?

2) From the way i coding, is that mean that the SMS Sending process will run backend ??


3)
Code:
$customerCount = $this->GetCustomerCount();
            for ($i=0; $i<$customerCount; $i++) {
                $customerNumber = $this->GetCustomerPhoneNumber();
                $this->SendSMS($customerNumber);
            }

Each time i call $this->SendSMS($customerNumber) it will took 2-3 seconds to send the sms.

The above code is fine if let's say i have 5 customers in my database.
What if I have 1000 customers in my database? The last customers will have to wait for 20-30 minutes in order to receive the SMS. In Java it can be done using Thread, but im not sure how i can do it in php .. Any built in function in CI that i can be used?

4) The system works fine in dedicated server. Do you think it will crashed when sending thousands of SMS if i move it to share hosting ?

PLEASE NOTES - In $this->SendSMS($customerNumber), I'll actually HTTPS to 3rd party gateway, and that gateway will in charge to send the sms.


Thanks guys




Theme © iAndrew 2016 - Forum software by © MyBB