Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(0);
- set_time_limit(0);
- ##-------------------------------##
- # Made by Ramadhani Pratama ##
- # Api Token Muchlis Faroqi ##
- # Copyright Karya Pemuda Kampung ##
- ##-------------------------------##
- #Note : reaction true likekomen true, berarti reaction untuk status dan likes untuk komen
- # reaction false, otomatis like beranda biasa, like komen true tetep like komen
- # reaction true like komen false berarti tidak like komen begitupun sebaliknya.
- ##SETTING DATA##
- $reaction = false; //true reaction on //false reaction off
- $reactionType = "LOVE"; //LIKE,HAHA,WOW,SAD,ANGRY
- $likeKomen = false; //true like komen berjalan /false like komen off
- print goLike("mr.foxdhan","Jones21011998",$likeKomen,$reaction,$reactionType); //Username/Password facebook
- ##END SETTING##
- //GOLIKE
- function goLike($username,$password,$likeKomen,$reaction,$reactionType){
- $access_token = file_get_contents('access_token.txt');
- $me = curl("https://graph.facebook.com/me?fields=id,name&access_token=".$access_token);
- $me = json_decode($me);
- if(@$me->id == null)
- {
- print 'access_token mati<br>refresss.......<br>';
- getToken($username,$password);
- }else{
- print getFeed($access_token,$likeKomen,$reaction,$reactionType);
- }
- }
- //GETTOKEN if(expired)
- function getToken($username,$password){
- $token = curl("https://www.likergram.net/GetToken.php?user=".$username."&pass=".$password); //getToken from my friends.
- print_r($token);
- $token = json_decode($token);
- unlink('access_token.txt'); //save file access_token
- $x=$token->access_token."";
- $y=fopen('access_token.txt','a');
- fwrite($y,$x);
- fclose($y);
- return $token->access_token;
- }
- //GETFEED (meHome)
- function getFeed($access_token,$likeKomen,$reaction,$reactionType){
- $apiFeed = curl("https://graph.facebook.com/me/home?fields=id,from,name&limit=5&access_token=".$access_token);
- $getFeed = json_decode($apiFeed);
- foreach ($getFeed->data as $n => $data) {
- if($reaction == true){
- print reaction($data->id,$data->from->name,$access_token,$reaction,$reactionType);
- if($likeKomen == true){
- $apiKomen = curl("https://graph.facebook.com/".$data->id."/comments?fields=id,from,name&limit=10&access_token=".$access_token);
- $getKomen = json_decode($apiKomen);
- foreach ($getKomen->data as $n1 => $datakomen) {
- print likes($datakomen->id,$datakomen->from->name,$access_token);
- }
- }
- }else{
- print likes($data->id,$data->from->name,$access_token);
- if($likeKomen == true){
- $apiKomen = curl("https://graph.facebook.com/".$data->id."/comments?fields=id,from,name&limit=10&access_token=".$access_token);
- $getKomen = json_decode($apiKomen);
- foreach ($getKomen->data as $n1 => $datakomen) {
- print likes($datakomen->id,$datakomen->from->name,$access_token);
- }
- }
- }
- }
- }
- //LIKESSTATUS (idPost)
- function likes($idPost,$from,$access_token){
- if(file_exists('logLikes.txt')){
- $log=json_encode(file('logLikes.txt'));
- }else{
- $log='';
- }
- if(!preg_match("/".$idPost."/",$log)){
- $x=$idPost."\n";
- $y=fopen('logLikes.txt','a');
- fwrite($y,$x);
- fclose($y);
- print postLikes($idPost,$from,$access_token);
- }else{
- print 'Semua status sudah anu.'; break;
- }
- }
- //REACTIONS
- function reaction($idPost,$from,$access_token,$reaction,$reactionType){
- if(file_exists('logLikes.txt')){
- $log=json_encode(file('logLikes.txt'));
- }else{
- $log='';
- }
- if(!preg_match("/".$idPost."/",$log)){
- $x=$idPost."\n";
- $y=fopen('logLikes.txt','a');
- fwrite($y,$x);
- fclose($y);
- print postReaction($idPost,$from,$access_token,$reactionType);
- }else{
- print 'Semua status sudah anu.'; break;
- }
- }
- //POSTLIKES
- function postLikes($idPost,$from,$access_token){
- $kirim = curl("https://graph.facebook.com/".$idPost."/likes", array(
- "method" => "post",
- "access_token" => $access_token));
- $result = json_decode($kirim);
- if($kirim=="true"){
- $notif = '<font color="green"> Sukses Like => '.$idPost.'</font><br>';
- return $notif;
- }else{
- $notif = '<font color="red"> Gagal Like => '.$idPost.'</font><br>';
- return $notif;
- }
- }
- function postReaction($idPost,$from,$access_token,$reactionType){
- $kirim = curl("https://graph.facebook.com/".$idPost."/reactions", array(
- "type" => $reactionType,
- "method" => "post",
- "access_token" => $access_token));
- $result = json_decode($kirim);
- $notif = '<font color="green"> Reaction Sukses => '.$idPost.'</font><br>';
- return $notif;
- }
- //CURL
- function curl($url, $post=null) {
- $c = curl_init();
- curl_setopt($c, CURLOPT_URL, $url);
- if($post != null){
- curl_setopt($c, CURLOPT_POST, true);
- curl_setopt($c, CURLOPT_POSTFIELDS, $post);
- }
- curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
- $curl = curl_exec($c);
- curl_close($c);
- return $curl;
- }
- ?>
Add Comment
Please, Sign In to add comment