HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux WebLive 5.15.0-79-generic #86-Ubuntu SMP Mon Jul 10 16:07:21 UTC 2023 x86_64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/wpprotonperinggit/wp-content/plugins/wp-cardealer/includes/sms/class-sms-twilio.php
<?php
/**
 * Agent
 *
 * @package    wp-cardealer
 * @author     Habq 
 * @license    GNU General Public License, version 3
 */

if ( ! defined( 'ABSPATH' ) ) {
  	exit;
}


use Twilio\Rest\Client;

class WP_CarDealer_SMS_Twilio{

	protected static $_instance = null;
	private $account_sid, $auth_token, $senders_number;

	public function __construct(){
		$this->set_credentials();
	}

	public static function get_instance(){
		if ( is_null( self::$_instance ) ) {
			self::$_instance = new self();
		}
		return self::$_instance;
	}


	private function set_credentials(){
		
		$this->account_sid 		= wp_cardealer_get_option('phone_approve_twilio_account_sid');
		$this->auth_token 		= wp_cardealer_get_option('phone_approve_twilio_auth_token');
		$this->senders_number 	= wp_cardealer_get_option('phone_approve_twilio_sender_number');	
	}

	public function sendSMS( $phone, $message ){

		$client = new Client(
			$this->account_sid,
			$this->auth_token
		);


		try {
		    $client->messages->create(
		    // Where to send a text message (your cell phone?)
			    $phone,
			    array(
			        'from' => $this->senders_number,
			        'body' => $message
			    )
			);
		} catch (Exception $e) {
		    // output error message if fails
		    return new WP_Error( 'operator-error', $e->getMessage() );
		}

	}

}