HenryGlazt

Petisi

Aug 11th, 2019
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.30 KB | None | 0 0
  1. <?php
  2. class Adil
  3. {
  4.     /**
  5.      * @copyright: YarzCode
  6.      * Negeri ini butuh keadilan, bukan hanya kesejahteraan
  7.      *           I'am Just a kids
  8.      */
  9.     public function support()
  10.     {
  11.         /**
  12.          * I know who I am, but by upholding justice is it wrong?
  13.          */
  14.         $banner =
  15.             "      KPI gak perlu merasa sok bertanggung jawab. Urusin dulu aja tayangan TV yg masih banyak alaynya, bobrok dan merusak mental masyarakat Indonesia. Gausah caper!
  16.                   #TolakKPIAwasiNetflixdanYoutube\n\n";
  17.         echo $banner;
  18.         echo "ID Petisi? ";
  19.         $petId = trim(fgets(STDIN));
  20.         echo "Amount (Jumlah)? ";
  21.         $amount = trim(fgets(STDIN));
  22.         $i=0;
  23.         echo "\n";
  24.         while($i<$amount)
  25.         {
  26.             $check = $this->curl('http://yarzc0de.co.id/api/newad.php', 'petition_id='.$petId);
  27.             if(json_decode($check[1],1)['success'] == true)
  28.             {
  29.                 echo "Support telah ditambahkan, Nama: ".json_decode($check[1],1)['name']."\n";
  30.             } else {
  31.                 echo $check[1]."\n";
  32.             }
  33.             $i++;
  34.         }
  35.     }
  36.  
  37.     private function curl($url, $post=false, $httpheader=false,$cookie=false)
  38.     {
  39.         $ch = curl_init();
  40.         curl_setopt($ch, CURLOPT_URL, $url);
  41.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  42.         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  43.         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  44.         curl_setopt($ch, CURLOPT_HEADER, 1);
  45.         if($cookie !== false)
  46.         {
  47.             curl_setopt($ch, CURLOPT_COOKIE, $cookie);
  48.             curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
  49.         }
  50.         if($post != false)
  51.         {
  52.             curl_setopt($ch, CURLOPT_POST, true);
  53.             curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
  54.         }
  55.         if($httpheader != false)
  56.         {
  57.             curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
  58.             curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
  59.         }
  60.         $response = curl_exec($ch);
  61.         $header = substr($response, 0, curl_getinfo($ch, CURLINFO_HEADER_SIZE));
  62.         $body = substr($response, curl_getinfo($ch, CURLINFO_HEADER_SIZE));
  63.         curl_close($ch);
  64.         return array($header, $body);
  65.     }
  66. }
  67. $a = new Adil();
  68. $a->support();
Advertisement
Add Comment
Please, Sign In to add comment