Guest User

anu cs

a guest
Aug 12th, 2017
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5.36 KB | None | 0 0
  1. <?php
  2. error_reporting(0);
  3. set_time_limit(0);
  4.  
  5. ##-------------------------------##
  6. # Made by Ramadhani Pratama      ##
  7. # Api Token Muchlis Faroqi       ##
  8. # Copyright Karya Pemuda Kampung ##
  9. ##-------------------------------##
  10.  
  11. #Note : reaction true likekomen true, berarti reaction untuk status dan likes untuk komen
  12. #       reaction false, otomatis like beranda biasa, like komen true tetep like komen
  13. #       reaction true like komen false berarti tidak like komen begitupun sebaliknya.
  14.  
  15. ##SETTING DATA##
  16. $reaction = false; //true reaction on //false reaction off
  17. $reactionType = "LOVE"; //LIKE,HAHA,WOW,SAD,ANGRY
  18. $likeKomen = false; //true like komen berjalan /false like komen off
  19. print goLike("mr.foxdhan","Jones21011998",$likeKomen,$reaction,$reactionType); //Username/Password facebook
  20. ##END SETTING##
  21.  
  22.  
  23. //GOLIKE
  24. function goLike($username,$password,$likeKomen,$reaction,$reactionType){
  25.    $access_token = file_get_contents('access_token.txt');
  26.    $me = curl("https://graph.facebook.com/me?fields=id,name&access_token=".$access_token);
  27.    $me = json_decode($me);
  28.    if(@$me->id == null)
  29.     {
  30.         print 'access_token mati<br>refresss.......<br>';
  31.         getToken($username,$password);
  32.     }else{
  33.         print getFeed($access_token,$likeKomen,$reaction,$reactionType);
  34.     }
  35. }
  36. //GETTOKEN if(expired)
  37. function getToken($username,$password){
  38.     $token = curl("https://www.likergram.net/GetToken.php?user=".$username."&pass=".$password); //getToken from my friends.
  39.     print_r($token);
  40.     $token = json_decode($token);
  41.     unlink('access_token.txt'); //save file access_token
  42.     $x=$token->access_token."";
  43.     $y=fopen('access_token.txt','a');
  44.     fwrite($y,$x);
  45.     fclose($y);
  46.     return $token->access_token;
  47. }
  48. //GETFEED (meHome)
  49. function getFeed($access_token,$likeKomen,$reaction,$reactionType){
  50.     $apiFeed = curl("https://graph.facebook.com/me/home?fields=id,from,name&limit=5&access_token=".$access_token);
  51.     $getFeed = json_decode($apiFeed);
  52.     foreach ($getFeed->data as $n => $data) {
  53.         if($reaction == true){
  54.             print reaction($data->id,$data->from->name,$access_token,$reaction,$reactionType);
  55.             if($likeKomen == true){
  56.                 $apiKomen = curl("https://graph.facebook.com/".$data->id."/comments?fields=id,from,name&limit=10&access_token=".$access_token);
  57.                 $getKomen = json_decode($apiKomen);
  58.                 foreach ($getKomen->data as $n1 => $datakomen) {
  59.                     print likes($datakomen->id,$datakomen->from->name,$access_token);
  60.                 }
  61.             }
  62.         }else{
  63.             print likes($data->id,$data->from->name,$access_token);
  64.             if($likeKomen == true){
  65.                 $apiKomen = curl("https://graph.facebook.com/".$data->id."/comments?fields=id,from,name&limit=10&access_token=".$access_token);
  66.                 $getKomen = json_decode($apiKomen);
  67.                 foreach ($getKomen->data as $n1 => $datakomen) {
  68.                     print likes($datakomen->id,$datakomen->from->name,$access_token);
  69.                 }
  70.             }
  71.         }
  72.     }
  73. }
  74. //LIKESSTATUS (idPost)
  75. function likes($idPost,$from,$access_token){
  76.     if(file_exists('logLikes.txt')){
  77.         $log=json_encode(file('logLikes.txt'));
  78.     }else{
  79.         $log='';
  80.     }
  81.     if(!preg_match("/".$idPost."/",$log)){
  82.         $x=$idPost."\n";
  83.         $y=fopen('logLikes.txt','a');
  84.         fwrite($y,$x);
  85.         fclose($y);
  86.         print postLikes($idPost,$from,$access_token);
  87.     }else{
  88.         print 'Semua status sudah anu.'; break;
  89.     }
  90. }
  91. //REACTIONS
  92. function reaction($idPost,$from,$access_token,$reaction,$reactionType){
  93.     if(file_exists('logLikes.txt')){
  94.         $log=json_encode(file('logLikes.txt'));
  95.     }else{
  96.         $log='';
  97.     }
  98.     if(!preg_match("/".$idPost."/",$log)){
  99.         $x=$idPost."\n";
  100.         $y=fopen('logLikes.txt','a');
  101.         fwrite($y,$x);
  102.         fclose($y);
  103.         print postReaction($idPost,$from,$access_token,$reactionType);
  104.     }else{
  105.         print 'Semua status sudah anu.'; break;
  106.     }
  107. }
  108. //POSTLIKES
  109. function postLikes($idPost,$from,$access_token){
  110.     $kirim = curl("https://graph.facebook.com/".$idPost."/likes", array(
  111.         "method" => "post",
  112.         "access_token" => $access_token));
  113.     $result = json_decode($kirim);
  114.     if($kirim=="true"){
  115.         $notif = '<font color="green"> Sukses Like => '.$idPost.'</font><br>';
  116.         return $notif;
  117.     }else{
  118.         $notif = '<font color="red"> Gagal Like => '.$idPost.'</font><br>';
  119.         return $notif;
  120.     }
  121. }
  122.  
  123. function postReaction($idPost,$from,$access_token,$reactionType){
  124.     $kirim = curl("https://graph.facebook.com/".$idPost."/reactions", array(
  125.         "type" => $reactionType,
  126.         "method" => "post",
  127.         "access_token" => $access_token));
  128.     $result = json_decode($kirim);
  129.     $notif = '<font color="green"> Reaction Sukses => '.$idPost.'</font><br>';
  130.     return $notif;
  131. }
  132. //CURL
  133. function curl($url, $post=null) {
  134.     $c = curl_init();
  135.     curl_setopt($c, CURLOPT_URL, $url);
  136.     if($post != null){
  137.         curl_setopt($c, CURLOPT_POST, true);
  138.         curl_setopt($c, CURLOPT_POSTFIELDS, $post);
  139.     }
  140.     curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
  141.     curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  142.     curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
  143.     $curl = curl_exec($c);
  144.     curl_close($c);
  145.     return $curl;
  146. }
  147. ?>
Add Comment
Please, Sign In to add comment