Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $token = "access_token";
- function curl($url, $post=null) {
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- if ($post!=null) {
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
- }
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- $eks = curl_exec($ch);
- return json_decode($eks);
- }
- function simsimi($str) {
- $jawab = curl("http://simsimi.com/getRealtimeReq?uuid=r5KZWDNqCpbqxlqfWisboiisKRmaNRHHMTlmHBFJZpV&lc=id&ft=0&reqText=".urlencode($str)."&status=W");
- if ($jawab->respSentence) {
- $pesen = $jawab->respSentence;
- } else {
- $pesen = ":p";
- }
- $preg = preg_replace("/simsimi|simi|Simsimi|Simi|.simi|sim/is", " w", $pesen);
- return $preg;
- }
- $me = curl("https://graph.facebook.com/me?access_token={$token}");
- $penta = curl("https://graph.facebook.com/me/home?access_token={$token}&fields=id,from,message&limit=10")->data;
- if (file_exists("log.txt")) {
- $log = json_encode(file("log.txt"));
- } else {
- $log = "";
- }
- foreach ($penta as $data) {
- $com = curl("https://graph.facebook.com/{$data->id}/comments?access_token={$token}&fields=id,message,from&method=get");
- if (sizeof($com->data) > 0) {
- foreach ($com->data as $kom) {
- if (eregi($kom->id, $log)) {
- echo "sudah";
- } else {
- $x = "{$kom->id} \n";
- $y = fopen("log.txt", "a");
- fwrite($y, $x);
- fclose($y);
- $naon = $kom->message;
- $euy = simsimi($naon);
- $mesej = "( ".$kom->from->name." : ".$naon." ) 👉 ".$euy;
- $mess = rawurlencode($mesej);
- if ($kom->from->id!==$me->id) {
- curl("https://graph.facebook.com/{$data->id}/comments","access_token={$token}&method=post&message={$mess}");
- curl("https://graph.facebook.com/{$data->id}/likes", "access_token={$token}&method=post");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment