Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?PHP
- date_default_timezone_set('UTC');
- $arrContextOptions=array(
- "ssl"=>array(
- "verify_peer"=>false,
- "verify_peer_name"=>false,
- ),
- );
- $token = "1070521047:AAEJMemE63Em-3ULbXGta7Rulq6Z8iUluWM";
- $telegram = [
- 'text' => 'wayToTwoCrown',
- 'chat_id' => '954384299'
- ];
- $doOnce = true;
- $url = 'https://time.aacargo.info/api/v2/';
- $file = file_get_contents($url, false, stream_context_create($arrContextOptions));
- $data = json_decode($file, true);
- $time = array();
- for ($i = 0; $i < 14; $i = $i + 1) {
- $status = $data['na'][$i]['status'];
- if ($status == "wayToTwoCrown") {
- $time[$i / 4] = $data['na'][$i]['time'];
- }
- }
- $currentTime = date('d.m.Y H:i:s', time());
- $difference = (strtotime($time[0]) - strtotime($currentTime)) / 60;
- echo "Current time: " . $currentTime . "</br>";
- echo $difference . " minutes left for wayToTwoCrown";
- if ((strtotime($time[0]) - strtotime($currentTime)) / 60 <= 8.0) {
- if ($doOnce) {
- file_get_contents('https://api.telegram.org/bot' . $token . '/sendMessage?' . http_build_query($telegram));
- $doOnce = false;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement