-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost.php
More file actions
24 lines (20 loc) · 790 Bytes
/
Copy pathpost.php
File metadata and controls
24 lines (20 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
require 'vendor/autoload.php';
require 'twitter.conf';
require 'user.conf';
require 'site.conf';
use Abraham\TwitterOAuth\TwitterOAuth;
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET);
$db = new SQLite3(__DIR__ . '/imagelog.db');
$likes = json_decode(file_get_contents(SITE_URL . '/api/image/recentLikes'), TRUE);
foreach ($likes as $like) {
$lookup_sql = "SELECT image FROM imagelog WHERE image = '" . $like['uid'] . "';";
$result = $db->query($lookup_sql);
if (!$result->fetchArray()[0]) {
$update = $connection->post("statuses/update", array("status" => $like['page_url']));
$insert_sql = "INSERT INTO imagelog (image) VALUES ('" . $like['uid'] . "');";
$db->query($insert_sql);
break;
}
}
echo "script complete\n\n";