-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathalert_main.php
82 lines (60 loc) · 1.62 KB
/
alert_main.php
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/php
<?php
//main file to define and send alert
//to be managed as CRON JOB to send alert
//NOT USED YET
require_once __DIR__.'/./settings.php';
require_once __DIR__.'/./TelegramBot/broadcast_sender.php';
require_once __DIR__.'/./TwitterBot/tweet_something.php';
require_once __DIR__.'/./GroupMeBot/bot.php';
// include the Diff class
require_once __DIR__.'/./class.Diff.php';
// file di appoggio per i dati
$file = dirname(__FILE__).'/data/protezione_civile.txt';
//per loggare le differenze
$file_diff = dirname(__FILE__).'/data/protezione_civile_diff.txt';
//preparo il getter
$data= new getdata();
//prelevo il dato attuale dal sito
$current=$data->getting_actual_website_prot();
//stampo il file protezione civile(la prima volta)
if(!file_exists($file))
{
file_put_contents($file, $current[0]);
}
else{
//se il file esiste già fare il confronto
$old=file_get_contents($file);
if($old!=$current[0])
{
send_alert($current);
file_put_contents($file, $current[0]);
}
else
{
//se non ci sono aggiornamenti non fare nulla
}
}
//function to send alert bomb!
//current[0] long data
//current[1] short data
function send_alert($current)
{
//inserire cosa fare in caso di invio allerta
print_r("invio allerta");
if($current[0]!="")
{
//TELEGRAM BROADCAST
//broadcast_go($current[0]);
}
if($current[1]!="")
{
//TWEET
//tweet_something($current[1],"..aggiornamento #protezionecivile #prato goo.gl/2wwPts #allertameteoTOS");
//print_r($current[1]);
sleep(30);
//GROUPME
//groupme_send($current[1]. "..aggiornamento #protezionecivile #prato goo.gl/2wwPts #allertameteoTOS");
}
}
?>