-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
62 lines (40 loc) · 1.78 KB
/
index.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
<?php
require_once './env.php';
$curl = curl_init();
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://cobalto.ufpel.edu.br/dashboard/cardapios/cardapio/listaCardapios?null&cmbRestaurante=6&_search=false&nd=1664135529458&rows=-1&page=1&sidx=refeicao+asc%2C+id&sord=asc",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET"
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
$date=date_create();
echo date_format($date,"d/m");
$tmessage = "Almoço ".date_format($date,"d/m")."\n\n";
for ($x = 0; $x <= count(json_decode($response)->rows); $x++) {
if (json_decode($response)->rows[$x]->refeicao == "ALMOÇO") {
$tmessage .= json_decode($response)->rows[$x]->nome."\n";
}
}
echo $tmessage;
use DG\Twitter\Twitter;
require_once './src/twitter.class.php';
// ENTER HERE YOUR CREDENTIALS (see readme.txt)
$twitter = new Twitter($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret);
try {
$tweet = $twitter->send($tmessage); // you can add $imagePath or array of image paths as second argument
} catch (DG\Twitter\TwitterException $e) {
echo 'Error: ' . $e->getMessage();
}
?>