Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ob_start('ob_gzhandler');
- $token = "";
- $like_komen = 1; // 1 = on, 2 = off
- $me = json_decode(file_get_contents('https://graph.facebook.com/me?access_token='.$token),true);
- if($me[id]){
- like($me[id], $like_komen,$token);
- }else{
- exit;
- }
- function _req($url){
- $opts = array(
- 19913 => 1,
- 10002 => $url,
- 10018 => 'MAUI-based Generic / bOt Koplak by Danz Ze',
- );
- $ch=curl_init();
- curl_setopt_array($ch,$opts);
- $result = curl_exec($ch);
- curl_close($ch);
- return $result;
- }
- function getData($dir,$token,$params){
- $param = array(
- 'access_token' => $token,
- );
- if($params){
- $arrayParams=array_merge($params,$param);
- }else{
- $arrayParams =$param;
- }
- $url = getUrl('graph',$dir,$arrayParams);
- $result = json_decode(_req($url),true);
- if($result[data]){
- return $result[data];
- }else{
- return $result;
- }
- }
- function getUrl($domain,$dir,$uri=null){
- if($uri){
- foreach($uri as $key =>$value){
- $parsing[] = $key . '=' . $value;
- }
- $parse = '?' . implode('&',$parsing);
- }
- return 'https://' . $domain . '.facebook.com/' . $dir . $parse;
- }
- function getLog($x,$y){
- if(file_exists('lk_'.$x)){
- $log=file_get_contents('lk_'.$x);
- }else{
- $log=' ';
- }
- if(ereg($y[id],$log)){
- return false;
- }else{
- if(strlen($log) > 5000){
- $n = strlen($log) - 5000;
- }else{
- $n= 0;
- }
- saveFile('lk_'.$x,substr($log,$n).' '.$y[id]);
- return true;
- }
- }
- function saveFile($x,$y){
- $f = fopen($x,'w');
- fwrite($f,$y);
- fclose($f);
- }
- function like($me,$c,$token){
- $home=getData('me/home',$token,array(
- 'fields' => 'id,from,comments.limit(100),comments.id',
- 'limit' => 20,
- )
- );
- foreach($home as $post){
- if($post[id]){ if(getLog($me,$post) && $me!=$post[from][id]){
- print getData($post[id].'/likes',$token,array(
- 'method' => 'post',
- )
- );
- } }
- if($c==1){
- $b = count($post[comments][data]);
- if($b >0){
- if( $b > 5){ $a=$b - 5; }else{ $a=0; }
- for($i=$a;$i<$b;$i++){ if($post[comments][data][$i][id]){
- if(getLog($me,$post[comments][data][$i])){
- getData($post[comments][data][$i][id].'/likes',$token,array('method'=>'post'));
- }
- }
- }
- }
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement