Advertisement
AbdulMuttaqin

[PHP] Bot Comment Facebook With Simi Simk

Oct 21st, 2017
421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.97 KB | None | 0 0
  1. <?php
  2.     $access_token= "EAAAAAYsX7TsBAF3vpx8yeebx4i9kzLN3jLyVDQRnhyKzxQSZBO0Anscrne9ngZBmxiMDaEGVpX70gPD8tHxZAPI0DD7efzRVP9hCvKZBkpb9qWx0SOXvKBYI1XRBGezMkrKyN2vXPjY3sgeWo62XVpKLYM8wi1r726ZBUDnOGch44NaNHA01UoJzgfKbl5cG7er8GxHLCrruLZCwgxiymH";
  3.     $me=json_decode(auto('https://graph.facebook.com/me?access_token='.$access_token.'&fields=id'),true);
  4.     $stat = json_decode(auto('https://graph.facebook.com/me/home?fields=id,from,message&access_token='.$access_token.'&offset=0&limit=100'),true);
  5.     if(file_exists('jakrapp.txt')){ $log = json_encode(file('jakrapp.txt')); }else{ $log=''; }
  6.     for($i=1;$i<=count($stat[data]);$i++){ $com = json_decode(auto('https://graph.facebook.com/'.$stat[data][$i-1][id].'/comments?access_token='.$access_token.'&limit=500&fields=id,message,from'),true);
  7.     if(count($com[data]) > 0){ for($c=1;$c<=count($com[data]);$c++){ if(ereg($com[data][$c-1][id],$log)){ echo' udah di respon njeng !! <hr/>';
  8.     }else{ $logx = $com[data][$c-1][id].' ';
  9.     $logy = fopen('jakrapp.txt','a');
  10.     fwrite($logy,$logx);
  11.     fclose($logy);
  12.     $gen=json_decode(auto('http://graph.facebook.com/'.$com[data][$c-1][from][id].'?fields=gender'),true);
  13.     if($gen[gender] == 'male'){ $arr_gen=array(' Mas ',' Om ',' Kang ',' Mbah ',' Eyang ',);
  14.     }else{
  15.     $arr_gen=array(' Miss ',' Eyang ',' Non ',' Neng ',);
  16.     }
  17.     $iniapa=explode(' ',$com[data][$c-1][from][name]);
  18.     $mumet = ''.$arr_gen[rand(0,count($arr_gen)-1)].'';
  19.     $nama = ' '.$mumet.' '.$com[data][$c-1][from][name].'';
  20.     $tag = ''.$com[data][$c-1][from][name].'';
  21.     $kata=$com[data][$c-1][message];
  22.     $urut = count($com[data]) + 1;
  23.      
  24.      
  25.     $banner = '.';
  26.     $arr_mess = simsimi($kata);
  27.     $message= ' '.$com[data][$c-1][from][name].' : '.$arr_mess.'';
  28.     $message_ken = $message;
  29.     if($com[data][$c-1][from][id] != $me[id]) {
  30.     $rsp[$i][] = urlencode($message_ken);
  31.     }
  32.     }
  33.     }
  34.     }
  35.     if(!empty($rsp[$i])){ $respon = implode('%0a',$rsp[$i]);
  36.     auto('https://graph.facebook.com/'.$stat[data][$i-1][id].'/comments?access_token='.$access_token.'&message='.$respon.'+'.urlencode($banner).'&method=post');
  37.     //auto('https://graph.facebook.com/'.$com[data][$c-1][id].'/likes?access_token='.$access_token.'&method=post');   // hilangin " // " sebelum auto kalo mau like komen
  38.      //auto('https://graph.facebook.com/'.$com[data][$i-1][id].'/pokes?access_token='.$access_token.'&method=post');    // hilangin " // " sebelum auto kalo mau jadi maho
  39.     }
  40.     }
  41.     function simsimi($str){
  42.         $jakrapp = array("tes");
  43.        $url="http://sandbox.api.simsimi.com/request.p?key=e3871e24-5965-48e4-918a-f84671fabc80&lc=id&ft=1.0&text=".urlencode($str);
  44.         $ch = curl_init();
  45.         curl_setopt($ch, CURLOPT_URL, $url);
  46.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  47.         //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  48.         curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; Linux i686) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5");
  49.         $exec = curl_exec($ch);
  50.         curl_close($ch);
  51.         $dec = json_decode($exec, true);
  52.         if(empty($dec)){
  53.                 echo $dec;
  54.                 return null;
  55.         }else{
  56.                 if(!empty($dec['response'])) $simi=$dec['response'];
  57.                 else{
  58.                         echo $exec;
  59.                         return "UP GAN!!";
  60.                 }
  61.                 if(strcmp($simi, "Aing teu nyaho eta bahasa.")==0)$preg=$jakrapp[array_rand($jakrapp)];
  62.                 elseif(preg_match("/You are too fast to answer|Terlalu cepat\! Kita akan berbicara sedikit lambat/is", $simi))$preg=$jakrapp[array_rand($jakrapp)];
  63.                 else $preg=preg_replace("/simsimi|simi|.simi|sim/is", " Jaka Taruna ", $simi);
  64.                 return $preg;          
  65.         }
  66. }
  67.  
  68. function auto($url){
  69. $curl = curl_init();
  70. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  71. curl_setopt($curl, CURLOPT_URL, $url);
  72. $ch = curl_exec($curl);
  73. curl_close($curl);
  74. return $ch;
  75. }
  76. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement