-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfunctions.php
44 lines (40 loc) · 1.28 KB
/
functions.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
<?php
function curlGet($Url){
if (!function_exists('curl_init')){
die('Sorry cURL is not installed!');
}
$ch = curl_init();
if (!defined('CURL_HTTP_VERSION_2_0')) {
define('CURL_HTTP_VERSION_2_0', 3);
}
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
curl_setopt($ch, CURLOPT_URL, $Url);
curl_setopt($ch, CURLOPT_REFERER, "https://hakim.one/bot");
curl_setopt($ch, CURLOPT_USERAGENT, "HakimMonitoringBot/1.0");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
function notifyOk($name) {
global $tChatID;
global $tToken;
$msg = 'Website ' . $name. " is up at " .date("h:i A");
$data = [
'text' => $msg,
'chat_id' => $tChatID
];
file_get_contents("https://api.telegram.org/bot$tToken/sendMessage?" . http_build_query($data) );
}
function notifyError($name) {
global $tChatID;
global $tToken;
$msg = 'Website ' . $name. " is down at " .date("h:i A");
$data = [
'text' => $msg,
'chat_id' => $tChatID
];
file_get_contents("https://api.telegram.org/bot$tToken/sendMessage?" . http_build_query($data) );
}