yudhaez0212

Untitled

Sep 21st, 2020
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. <?php
  2. $path = "https://api.telegram.org/bot1301203321:AAEzskxJAxAtL5FfJEGrLJg4nzQjE1L6hDI";
  3. $update = json_decode(file_get_contents("php://input"), TRUE);
  4.  
  5. $chatId = $update["message"]["chat"]["id"];
  6. $message = $update["message"]["text"];
  7.  
  8. if (strpos($message, "/value") === 0) {
  9. $value = explode(' ', $message);
  10.  
  11. $url = 'http://simastupen.com/api/apisimas.php?key=inet&value='.$value;
  12. $curl = curl_init();
  13. curl_setopt_array($curl, array(
  14. CURLOPT_URL => $url,
  15. CURLOPT_RETURNTRANSFER => true,
  16. CURLOPT_ENCODING => "",
  17. CURLOPT_MAXREDIRS => 10,
  18. CURLOPT_TIMEOUT => 60,
  19. CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  20. CURLOPT_CUSTOMREQUEST => "GET",
  21. // CURLOPT_POSTFIELDS => json_encode($data_gopay),
  22. // CURLOPT_HTTPHEADER => array(
  23. // "Content-Type: application/json",
  24. // "cache-control: no-cache",
  25. // "Authorization: Basic " . base64_encode(MIDTRANS_SERVERKEY . ':')
  26. // ),
  27. ));
  28.  
  29. $response = curl_exec($curl);
  30. $result = json_decode($response, true);
  31. $html = 'Nama : '.$result['namaplg'].'%0a';
  32. $html.= 'Alamat : '.$result['alamatplg'].'%0a';
  33. $html.= 'Kode Tracking : '.$result['trackid'].'%0a';
  34. $html.= 'Simas ID : '.$result['idmtsales'].'%0a';
  35. $html.= 'Tanggal input Simas : '.$result['tglsales'].'%0a';
  36. $html.= 'Status Validitas : '.$result['statusvaliditas'].'%0a';
  37. $html.= 'Status SSCBE : '.$result['statusscbe'].'%0a';
  38. $html.= 'STO : '.$result['sto'].'%0a';
  39. $html.= 'STO Area : '.$result['stoarea'].'%0a';
  40. $html.= 'Koordinat : '.$result['koordplg'].'%0a';
  41. $html.= 'ODP : '.$result['labelodp'].'%0a';
  42. $html.= 'Internet : '.$result['inet'].'%0a';
  43. $html.= 'SC : '.$result['sc'].'%0a';
  44.  
  45. if (!$response) {
  46. $html = 'Data tidak ditemukan';
  47. }
  48.  
  49. file_get_contents(
  50. $path.
  51. "/sendmessage?chat_id=".
  52. $chatId.
  53. "&text=".$html
  54. );
  55. // file_get_contents(
  56. // $path.
  57. // "/sendmessage?chat_id=".
  58. // $chatId.
  59. // "&text=".$namaWaifu
  60. // );
  61. }
  62.  
  63. ?>
  64.  
Add Comment
Please, Sign In to add comment