· 5 years ago · Feb 18, 2021, 12:46 PM
1<?php
2
3/* Auto Like + Auto Re-Tweet By Koceng */
4
5error_reporting(0);
6require 'vendor/autoload.php'; //Download Dulu kalo Tidak Punya
7
8use Abraham\TwitterOAuth\TwitterOAuth;
9
10// API KEY TWITTER (Ambil Di apps.twitter.com)
11$consumer_key = '*******';
12$consumer_secret = '*******';
13$access_token = '*******';
14$access_token_secret = '*******';
15
16// Config Auto Like
17$i = 1;
18$total_tweet = 3; // Tweet per Action / Jumlah tweet yang mau Di Like Tiap Berjalan
19
20// Connect to Account
21$connection = new TwitterOAuth($consumer_key, $consumer_secret, $access_token, $access_token_secret);
22$connection->get('account/verify_credentials');
23
24if ($connection->getLastHttpCode() == 200) {
25 // Get Tweet Status
26
27
28 $get_status = $connection->get('statuses/home_timeline', ['count' => $total_tweet]);
29
30 foreach ($get_status as $status) {
31 $id = $status->id;
32 sleep(3);
33 //Simpan LOG
34$Simpan ="$id";
35$dataString = $Simpan;
36$dataString .= "\n";
37$fWrite = fopen("LogLikes.txt","a");
38$wrote = fwrite($fWrite, $dataString);
39fclose($fWrite);
40
41
42
43 //AUTO Like Tweet
44
45 $connection->post('favorites/create', ['id' => $id]);
46
47
48 //AUTO Retweet ( hilangkan /-* )
49
50 /* $connection->post('statuses/retweet', ['id' => $id]); */
51
52
53
54 if ($connection->getLastHttpCode() == 200) {
55 echo $i . ' Successfully like ' . $id . '</br>';
56 $i++;
57 } else {
58 echo 'Failed to like to the tweet!';
59 break;
60 }
61 }
62
63 IF (file_exists('LogLikes.txt')) {
64 $log = json_encode(file('LogLikes.txt'));
65} ELSE {
66 $log = '';
67}
68} else {
69 echo 'Invalid API key!';
70}
71