diamondpedia

ClassWapisender

Jul 2nd, 2021
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.03 KB | None | 0 0
  1. <?php
  2. // This Script Recode By Mikel Yonathan : 6285157513313
  3. // - ClassWhatsapp Wapisender.com
  4. // - Pembuatan BOT ? PM 6285157513313 Pihak Ke 3 Wapisender.com
  5.  
  6. function CurlSend($action,$parameter) {
  7.     $ch = curl_init();
  8.     curl_setopt($ch, CURLOPT_URL, "https://wapisender.com/api/v1/".$action."");
  9.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  10.     curl_setopt($ch, CURLOPT_POST, 1);
  11.     curl_setopt($ch, CURLOPT_POSTFIELDS, $parameter);
  12.     $result = curl_exec($ch);
  13.     $json = json_decode($result, true);
  14.     return $json;
  15. }
  16.  
  17. class WAPISENDER {
  18.         function __construct($data) {
  19.         $this->key = $data['key'];
  20.         $this->device = $data['device'];
  21.     }
  22.  
  23.     public function SendMessage($pesan,$nomer) {
  24.         $request = array(
  25.             'key' => $this->key,
  26.             'device' => $this->device,
  27.             'destination' => $nomer,
  28.             'message' => $pesan
  29.         );
  30.         $post = CurlSend('send-message',$request);
  31.         if($post == true) {
  32.             return $post;
  33.         } else {
  34.             return $post['message'];
  35.     }
  36. }
  37.     public function sendMessageGroup($group_id,$text) {
  38.         $request = array(
  39.             'key' => $this->key,
  40.             'device' => $this->device,
  41.             'group_id' => $group_id,
  42.             'message' => $text
  43.         );
  44.         $post = CurlSend('send-message',$request);
  45.         if($post == true) {
  46.             return $post;
  47.         } else {
  48.             return $post['message'];
  49.         }
  50.     }
  51.     public function SendImage($nomer,$source,$filename,$caption) {
  52.         $request = array(
  53.             'key' => $this->key,
  54.             'device' => $this->device,
  55.             'destination' => $nomer,
  56.             'image' => base64_encode(file_get_contents($source)),
  57.             'filename' => $filename,
  58.             'caption' => $caption
  59.         );
  60.         $post = CurlSend('send-image',$request);
  61.         if($post == true) {
  62.             return $post;
  63.         } else {
  64.             return $post['message'];
  65.     }
  66. }
  67.     public function SendVideo($nomer,$source,$filename,$caption) {
  68.         $request = array(
  69.             'key' => $this->key,
  70.             'device' => $this->device,
  71.             'destination' => $nomer,
  72.             'video' => base64_encode(file_get_contents($source)),
  73.             'filename' => $filename,
  74.             'caption' => $caption
  75.         );
  76.         $post = CurlSend('send-image',$request);
  77.         if($post == true) {
  78.             return $post;
  79.         } else {
  80.             return $post['message'];
  81.     }
  82. }
  83.  
  84.     public function SendAudio($nomer,$audio,$filename) {
  85.         $request = array(
  86.             'key' => $this->key,
  87.             'device' => $this->device,
  88.             'destination' => $nomer,
  89.             'audio' => base64_encode(file_get_contents($audio)),
  90.             'filename' => $filename
  91.         );
  92.         $post = CurlSend('send-audio',$request);
  93.         if($post == true) {
  94.             return $post;
  95.         } else {
  96.             return $post['message'];
  97.     }
  98. }
  99.     public function SendDoc($nomer,$doc,$filename,$caption) {
  100.         $request = array(
  101.             'key' => $this->key,
  102.             'device' => $this->device,
  103.             'destination' => $nomer,
  104.             'document' => base64_encode(file_get_contents($doc)),
  105.             'filename' => $filename,
  106.             'caption' => $caption
  107.         );
  108.         $post = CurlSend('send-document',$request);
  109.         if($post == true) {
  110.             return $post;
  111.         } else {
  112.             return $post['message'];
  113.     }
  114. }
  115. public function SendLoc($nomer,$lat,$long,$address) {
  116.         $request = array(
  117.             'key' => $this->key,
  118.             'device' => $this->device,
  119.             'destination' => $nomer,
  120.             'lat' => $lat,
  121.             'long' => $long,
  122.             'address' => $address
  123.         );
  124.         $post = CurlSend('send-location',$request);
  125.         if($post == true) {
  126.             return $post;
  127.         } else {
  128.             return $post['message'];
  129.     }
  130. }
  131. public function AddMember($group,$nomer) {
  132.         $request = array(
  133.             'key' => $this->key,
  134.             'device' => $this->device,
  135.             'group_id' => $group,
  136.             'contact_number' => $nomer,
  137.             'action' => "add",
  138.         );
  139.         $post = CurlSend('group-member',$request);
  140.         if($post == true) {
  141.             return $post;
  142.         } else {
  143.             return $post['message'];
  144.     }
  145. }
  146. public function KickMember($group,$nomer) {
  147.         $request = array(
  148.             'key' => $this->key,
  149.             'device' => $this->device,
  150.             'group_id' => $group,
  151.             'contact_number' => $nomer,
  152.             'action' => "kick",
  153.         );
  154.         $post = CurlSend('group-member',$request);
  155.         if($post == true) {
  156.             return $post;
  157.         } else {
  158.             return $post['message'];
  159.     }
  160. }
  161. }
  162.  
  163. $WASENDER = new WAPISENDER(['key' => "api key wapisender", 'device' => "devices id wapisender"]);
Add Comment
Please, Sign In to add comment