This commit is contained in:
CHIEFSOFT\ameye
2024-10-21 19:23:45 -04:00
parent e4f6ef5044
commit 1e10bbbc2f
2 changed files with 22 additions and 4 deletions
+19 -1
View File
@@ -10,6 +10,7 @@ use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use Exception;
use Twilio\Rest\Client;
/**
* Class BaseController
@@ -136,8 +137,25 @@ abstract class BaseController extends Controller
$password = substr( str_shuffle(sha1(rand() . time()) . $chars ), 0, $length );
return $password;
}
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";
$BASE_URL = "https://api.ng.termii.com";
log_message('error', "SMS TO API---=>". $to_number);