-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweb_content.php
More file actions
43 lines (27 loc) · 1011 Bytes
/
web_content.php
File metadata and controls
43 lines (27 loc) · 1011 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
include('includes.php');
echo '<pre>';
$query = "SELECT content_id, source, url, timestamp, notified FROM web_content";
$sentiments = query($query, $config);
if (!empty($sentiments))
foreach ($sentiments as $sentiment) {
$config['exchange'] = $sentiment['source'];
$config = config_exchange($config);
$config['url'] = $sentiment['url'];
$content_new = info($config);
$values = array();
$values['content'] = $content_new['data']['children'][0]['data']['selftext'];
# is new sentiment content?
if (!isset($sentiment['content_id'])) {
$query = query('update_content', $config, $values);
# is comparing existing content?
} else {
$values['filterquery'] = " WHERE `content_id` = '" . $sentiment['content_id'] . "'";
$content_old = query('get_content', $config, $values);
if ($content_old[0]['content'] !== $values['content']) {
$config['chatText'] = 'content changed at [this link](' . $sentiment['url'] . ')';
telegram($config);
}
}
}
include('system_metrics.php');