/var/www/vhosts/nabawater/common/helpers
NameSizeModeActions
AccessRules.php120510644editdlrm
AuthHandler.php75560644editdlrm
Aws.php57620644editdlrm
ChunkHelper.php9590644editdlrm
Com.php224100644editdlrm
DateTimeHelper.php71550644editdlrm
FBHelper.php41120644editdlrm
FileUploadHelper.php43510644editdlrm
GeoHelper.php125350644editdlrm
GeoMetricHelper.php55140644editdlrm
IPay88Helper.php46420644editdlrm
JwtHelper.php36730644editdlrm
Mailer.php45350644editdlrm
MailerQueueHelper.php31710644editdlrm
ModelHelper.php25530644editdlrm
OneSignal.php73770644editdlrm
PaymentHelper.php57840644editdlrm
QrHelper.php24560644editdlrm
RabbitMQHelper.php24060644editdlrm
SmsGateway.php18620644editdlrm
StripeHelper.php33350644editdlrm
UploadHelper.php161640644editdlrm
Edit: /var/www/vhosts/nabawater/common/helpers/SmsGateway.php (1862B)
* This GatewayApi is used to send SMS * Class SmsGateway (used GuzzleHttp) * @package common\helpers * @author Baluraj R */ namespace common\helpers; use common\models\Configuration; use yii\helpers\Json; use Twilio\Rest\Client; class SmsGateway { private $api_key; private static $instance; private $from; public function __construct() { $this->setApiKey(Configuration::get(Configuration::SMS_ACCOUNT_ID)); $this->setFrom(Configuration::get(Configuration::SMS_GATEWAY_FROM)); } public static function getInstance() { if (self::$instance === null) { self::$instance = new self(); } return self::$instance; } public function setApiKey($apikey) { $this->api_key = $apikey; } public function setFrom($from) { $this->from = $from; return $this; } public function sendSMS($mobile, $msg) { try { // Account details $apiKey = $this->api_key; $sender = $this->from; $message = rawurlencode($msg); // Prepare data for POST request $data = array('apikey' => $apiKey, 'numbers' => $mobile, "sender" => $sender, "message" => $message); // Send the POST request with cURL $ch = curl_init('https://api.textlocal.in/send/'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); return $response; } catch (\Exception $Ste) { return $Ste; } } }