Send SMS
This commit is contained in:
@@ -10,6 +10,7 @@ use CodeIgniter\HTTP\RequestInterface;
|
|||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use Twilio\Rest\Client;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class BaseController
|
* Class BaseController
|
||||||
@@ -136,8 +137,25 @@ abstract class BaseController extends Controller
|
|||||||
$password = substr( str_shuffle(sha1(rand() . time()) . $chars ), 0, $length );
|
$password = substr( str_shuffle(sha1(rand() . time()) . $chars ), 0, $length );
|
||||||
return $password;
|
return $password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendSMS($to_number, $sms_message):string{
|
public function sendSMS($to_number, $sms_message):string{
|
||||||
|
|
||||||
|
// Find your Account SID and Auth Token at twilio.com/console
|
||||||
|
// and set the environment variables. See http://twil.io/secure
|
||||||
|
$sid = getenv("TWILIO_ACCOUNT_SID");
|
||||||
|
$token = getenv("TWILIO_AUTH_TOKEN");
|
||||||
|
$twilio = new \Twilio\Rest\Client($sid, $token); //Twilio\Rest\Client
|
||||||
|
|
||||||
|
$message = $twilio->messages->create(
|
||||||
|
"+2348141331999", // To
|
||||||
|
[
|
||||||
|
"body" =>
|
||||||
|
$sms_message,
|
||||||
|
"from" => "+14706008089",
|
||||||
|
]
|
||||||
|
);
|
||||||
|
return $message->body;
|
||||||
|
}
|
||||||
|
public function sendSMS_OLD($to_number, $sms_message):string{
|
||||||
$API_KEY ="TLYsgMTZBeasJHHimcWXG1QPHmjH7FPwnbKwiqTEwGCu6TrK0v13hCn8N6SYZp";
|
$API_KEY ="TLYsgMTZBeasJHHimcWXG1QPHmjH7FPwnbKwiqTEwGCu6TrK0v13hCn8N6SYZp";
|
||||||
$BASE_URL = "https://api.ng.termii.com";
|
$BASE_URL = "https://api.ng.termii.com";
|
||||||
log_message('error', "SMS TO API---=>". $to_number);
|
log_message('error', "SMS TO API---=>". $to_number);
|
||||||
|
|||||||
@@ -152,9 +152,9 @@ class DigiFiBVN extends BaseController
|
|||||||
$pin = rand(10000, 99999);
|
$pin = rand(10000, 99999);
|
||||||
//2347036251482
|
//2347036251482
|
||||||
// $smsSend = $this->sendSMS("2347032847884", "This is your pin number ". $pin);
|
// $smsSend = $this->sendSMS("2347032847884", "This is your pin number ". $pin);
|
||||||
$smsSend = $this->sendSMS("2347036251482", "This is your pin number ". $pin);
|
// $smsSend = $this->sendSMS("2347036251482", "This is your pin number ". $pin);
|
||||||
$smsSend = $this->sendSMS("+2347036251482", "This is your pin number ". $pin);
|
// $smsSend = $this->sendSMS("+2347036251482", "This is your pin number ". $pin);
|
||||||
$smsSend = $this->sendSMS("2349063572875", "This is your pin number ". $pin);
|
// $smsSend = $this->sendSMS("2349063572875", "This is your pin number ". $pin);
|
||||||
$smsSend = $this->sendSMS("+2349063572875", "This is your pin number ". $pin);
|
$smsSend = $this->sendSMS("+2349063572875", "This is your pin number ". $pin);
|
||||||
|
|
||||||
//+2347032847884
|
//+2347032847884
|
||||||
|
|||||||
Reference in New Issue
Block a user