Advertisement
JackHaxor

Scan comment tim ng tra loi dung

Aug 20th, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.07 KB | None | 0 0
  1. <?php
  2. set_time_limit(0);
  3. error_reporting(0);
  4. $log = fopen('log.html', 'w');
  5. fwrite($log, '');
  6. fclose($log);
  7. $like = fopen('like.html', 'w');
  8. fwrite($like, '');
  9. fclose($like);
  10. $token = "token ios facebook";
  11.  
  12. $idpost = "400399000027332_1618858271514726"; //id Post trên Page
  13. $idpost2 = "1618858271514726_"; //id post
  14. $namepage = "Mamamy"; //name page
  15. $getlike = json_decode(request('https://graph.facebook.com/v2.9/' . $idpost . '?fields=reactions.limit(10000).summary(true)&access_token=' . $token), true);
  16. $countlike = $getlike['reactions']['summary']['total_count'];
  17. for ($i = 0; $i < $countlike; $i++) {
  18. $idlike = $getlike['reactions']['data'][$i]['id'];
  19. $luulog = fopen("like.html", "a");
  20. $data = $idlike . '|';
  21. fwrite($luulog, $data);
  22. fclose($luulog);
  23. }
  24. $like = file_get_contents("like.html");
  25. $getcmt = json_decode(request('https://graph.facebook.com/' . $idpost . '/?fields=comments.summary(true).limit(10000){message}&access_token=' . $token), true);
  26. $count = $getcmt['comments']['summary']['total_count'];
  27. $ketqua = "doi vo lay qua"; //câu trả lời không dấu , viết thường
  28. for ($b = 0; $b < $count; $b++) {
  29. $cmt = $getcmt['comments']['data'][$b]['message'];
  30. $idcmt = $getcmt['comments']['data'][$b]['id'];
  31.  
  32. /* Check kết quả Cmt */
  33. if (strpos(strtolower(vn($cmt)), $ketqua) !== false) {
  34. /* Check Reply Cmt*/
  35. $getrepcmt = json_decode(request('https://graph.facebook.com/v2.9/' . $idpost2 . $idcmt . '?fields=comments.summary(true).limit(10000){message}&access_token=' . $token), true);
  36. $count_repcmt = $getrepcmt['comments']['summary']['total_count'];
  37.  
  38. for ($c = 0; $c < $count_repcmt; $c++) {
  39. $cmtrep = $getrepcmt['comments']['data'][$c]['message'];
  40. $idcmtrep = $getrepcmt['comments']['data'][$c]['id'];
  41. $checktag = json_decode(request('https://graph.facebook.com/' . $idcmtrep . '?fields=message_tags&access_token=' . $token), true);
  42. $counttag = count($checktag['message_tags']);
  43. if ($counttag >= 3) {
  44. $getinfo = json_decode(request('https://graph.facebook.com/' . $idcmtrep . '?fields=from&access_token=' . $token), true);
  45. $name = $getinfo['from']['name'];
  46. $iduser = $getinfo['from']['id'];
  47. /* Check Share */
  48. $getshare = file_get_contents('https://graph.facebook.com/' . $iduser . '/feed?limit=30&access_token=' . $token);
  49.  
  50.  
  51. if (strpos($like, $iduser) !== false) {
  52. if (strpos($getshare, $namepage) !== false) {
  53. $data = $name . "|<a href='https://facebook.com/" . $idcmtrep . "'>Xem Comment</a>(reply)(đã like)<br>\n";
  54. } else {
  55. $data = $name . "|<a href='https://facebook.com/" . $idcmtrep . "'>Xem Comment</a>(reply)(Chưa Share)(đã like)</br>\n";
  56.  
  57. }
  58. }else{
  59.  
  60. if (strpos($getshare, $namepage) !== false) {
  61. $data = $name . "|<a href='https://facebook.com/" . $idcmtrep . "'>Xem Comment</a>(reply)(chưa like)<br>\n";
  62. } else {
  63. $data = $name . "|<a href='https://facebook.com/" . $idcmtrep . "'>Xem Comment</a>(reply)(Chưa Share)(chưa like)</br>\n";
  64.  
  65. }
  66.  
  67.  
  68.  
  69. }
  70.  
  71. echo $data;
  72. $luulog = fopen("log.html", "a");
  73. fwrite($luulog, $data);
  74. fclose($luulog);
  75.  
  76. }
  77.  
  78. }
  79. /* END Check Reply Cmt*/
  80.  
  81. /* Check Tag Friend*/
  82. $checktag = json_decode(request('https://graph.facebook.com/' . $idcmt . '?fields=message_tags&access_token=' . $token), true);
  83. $counttag = count($checktag['message_tags']);
  84. if ($counttag >= 3) {
  85. $getinfo = json_decode(request('https://graph.facebook.com/' . $idcmt . '?fields=from&access_token=' . $token), true);
  86. $name = $getinfo['from']['name'];
  87. $iduser = $getinfo['from']['id'];
  88. /* Check Share */
  89. $getshare = file_get_contents('https://graph.facebook.com/' . $iduser . '/feed?limit=30&access_token=' . $token);
  90.  
  91. if (strpos($like, $iduser) !== false) {
  92. if (strpos($getshare, $namepage) !== false) {
  93. $data = $name . "|<a href='https://facebook.com/" . $idcmt . "'>Xem Comment</a>(đã like)<br>\n";
  94. } else {
  95. $data = $name . "|<a href='https://facebook.com/" . $idcmt . "'>Xem Comment</a>(reply)(Chưa Share)(đã like)</br>\n";
  96.  
  97. }
  98. }else{
  99.  
  100. if (strpos($getshare, $namepage) !== false) {
  101. $data = $name . "|<a href='https://facebook.com/" . $idcmt . "'>Xem Comment</a>(chưa like)<br>\n";
  102. } else {
  103. $data = $name . "|<a href='https://facebook.com/" . $idcmt . "'>Xem Comment</a>(Chưa Share)(chưa like)</br>\n";
  104.  
  105. }
  106. }
  107. echo $data;
  108. $luulog = fopen("log.html", "a");
  109. fwrite($luulog, $data);
  110. fclose($luulog);
  111. }
  112.  
  113. }
  114.  
  115. }
  116.  
  117. function request($url)
  118. {
  119. if (!filter_var($url, FILTER_VALIDATE_URL)) {
  120. return FALSE;
  121. }
  122.  
  123. $options = array(
  124. CURLOPT_URL => $url,
  125. CURLOPT_RETURNTRANSFER => TRUE,
  126. CURLOPT_HEADER => FALSE,
  127. CURLOPT_FOLLOWLOCATION => TRUE,
  128. CURLOPT_ENCODING => '',
  129. CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.87 Safari/537.36',
  130. CURLOPT_AUTOREFERER => TRUE,
  131. CURLOPT_CONNECTTIMEOUT => 15,
  132. CURLOPT_TIMEOUT => 15,
  133. CURLOPT_MAXREDIRS => 5,
  134. CURLOPT_SSL_VERIFYHOST => 2,
  135. CURLOPT_SSL_VERIFYPEER => 0
  136. );
  137.  
  138. $ch = curl_init();
  139. curl_setopt_array($ch, $options);
  140. $response = curl_exec($ch);
  141. $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  142. curl_close($ch);
  143. unset($options);
  144. return $http_code === 200 ? $response : FALSE;
  145. }
  146. function vn($str)
  147. {
  148.  
  149. $unicode = array(
  150.  
  151. 'a' => 'á|à|ả|ã|ạ|ă|ắ|ặ|ằ|ẳ|ẵ|â|ấ|ầ|ẩ|ẫ|ậ',
  152.  
  153. 'd' => 'đ',
  154.  
  155. 'e' => 'é|è|ẻ|ẽ|ẹ|ê|ế|ề|ể|ễ|ệ',
  156.  
  157. 'i' => 'í|ì|ỉ|ĩ|ị',
  158.  
  159. 'o' => 'ó|ò|ỏ|õ|ọ|ô|ố|ồ|ổ|ỗ|ộ|ơ|ớ|ờ|ở|ỡ|ợ',
  160.  
  161. 'u' => 'ú|ù|ủ|ũ|ụ|ư|ứ|ừ|ử|ữ|ự',
  162.  
  163. 'y' => 'ý|ỳ|ỷ|ỹ|ỵ',
  164.  
  165. 'A' => 'Á|À|Ả|Ã|Ạ|Ă|Ắ|Ặ|Ằ|Ẳ|Ẵ|Â|Ấ|Ầ|Ẩ|Ẫ|Ậ',
  166.  
  167. 'D' => 'Đ',
  168.  
  169. 'E' => 'É|È|Ẻ|Ẽ|Ẹ|Ê|Ế|Ề|Ể|Ễ|Ệ',
  170.  
  171. 'I' => 'Í|Ì|Ỉ|Ĩ|Ị',
  172.  
  173. 'O' => 'Ó|Ò|Ỏ|Õ|Ọ|Ô|Ố|Ồ|Ổ|Ỗ|Ộ|Ơ|Ớ|Ờ|Ở|Ỡ|Ợ',
  174.  
  175. 'U' => 'Ú|Ù|Ủ|Ũ|Ụ|Ư|Ứ|Ừ|Ử|Ữ|Ự',
  176.  
  177. 'Y' => 'Ý|Ỳ|Ỷ|Ỹ|Ỵ'
  178.  
  179. );
  180.  
  181. foreach ($unicode as $nonUnicode => $uni) {
  182.  
  183. $str = preg_replace("/($uni)/i", $nonUnicode, $str);
  184.  
  185. }
  186.  
  187. return $str;
  188.  
  189. }
  190. ?>
  191.  
  192. * Công dụng : Scan tất cả comment để tìm xem ai trả lời câu hỏi đúng sau đó check tag 3 friend không nếu có thì tiếp tục check có share bài viết không :v . ( Nếu cmt trả lời đúng nhưng ko tag bạn bè thì sẽ check cmt reply )
  193. * Script : ( sửa token và idpost + tên page nhé dùng token ios )
  194. * Cách dùng : tải xampp về rồi lưu đoạn script lại "tenfile.php"
  195. - Ở panel xampp click vào button shell sẽ hiện lên một bảng cmd , di chuyển đến thư mục chứa file mình mới lưu ( ở đây mình lưu ở thư mục htdocs nên dùng lệnh " cd htdocs" )
  196. Sau đó dùng lệnh "php tenfile.php" để chạy đoạn script và kết quả sẽ hiện lên bảng cmd + đc lưu lại ở file log.html
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement