<?php header('Content-type: text/plain'); require_once '../inc/psiHelper.php'; $psi3hr = array(); $psi24hr = array(); $comments = ""; getPsiData($psi3hr, $psi24hr, $comments); echo '$psi3Hr '; print_r($psi3hr); echo "psi 3-Hr main reading: "; echo $psi3hr["main"]; echo "\n\n"; echo '$psi24Hr '; print_r($psi24hr); echo "\n\n"; echo getTextPsi("/psi"); echo "\n\n"; echo getTextPsi("/psi3"); echo "\n\n"; echo getTextPsi("/psi24"); echo "\n\n";
function processTelegramRequest($yulonglongBot) { if (isset($_GET['unset'])) { if ($yulonglongBot->unsetWebhook()) { echo "Webhook was deleted"; } } else { if (isset($_GET['set'])) { if ($yulonglongBot->setWebhook()) { echo "Webhook was set"; } } else { if ($yulonglongBot->isValidUserCommand("/start")) { $content = array("text" => 'Hello, ' . $yulonglongBot->FirstName() . ".\nMay I help you?"); $yulonglongBot->endpoint("sendMessage", $content, true); } else { if ($yulonglongBot->isValidUserCommand("/hello") || $yulonglongBot->isValidUserCommand("/hi")) { $content = array("text" => 'Nice to meet you, ' . $yulonglongBot->FirstName()); $yulonglongBot->endpoint("sendMessage", $content, true); } else { if (strcasecmp($yulonglongBot->Text(), "hi") == 0 || strcasecmp($yulonglongBot->Text(), "hello") == 0) { $content = array("text" => 'I am at your service, Master ' . $yulonglongBot->LastName()); $yulonglongBot->endpoint("sendMessage", $content, true); } else { if ($yulonglongBot->isValidUserCommand("/getpic")) { $command = $yulonglongBot->Command(); if (isset($command[1])) { if (file_exists('files/' . $command[1] . '.jpg')) { $contentText = array("text" => 'Please wait while uploading image...'); $yulonglongBot->sendMessage($contentText); $contentAction = array("action" => 'upload_photo'); $yulonglongBot->sendChatAction($contentAction); $img = curl_file_create('files/' . $command[1] . '.jpg', 'image/jpeg'); $photoContent = array('photo' => $img); $yulonglongBot->sendPhoto($photoContent); } else { $contentText = array('chat_id' => $yulonglongBot->chatID(), "text" => 'Sorry, file does not exist.'); $yulonglongBot->sendMessage($contentText); } } else { $contentText = array("text" => 'Please define image name.'); $yulonglongBot->endpoint("sendMessage", $contentText, true); } } else { if ($yulonglongBot->isValidUserCommand("/getpic")) { $command = $yulonglongBot->Command(); if (isset($command[1])) { if (file_exists('files/' . $command[1] . '.jpg')) { $contentText = array("text" => 'Please wait while uploading image...'); $yulonglongBot->sendMessage($contentText); $contentAction = array("action" => 'upload_photo'); $yulonglongBot->sendChatAction($contentAction); $img = curl_file_create('files/' . $command[1] . '.jpg', 'image/jpeg'); $photoContent = array('photo' => $img); $yulonglongBot->sendPhoto($photoContent); } else { $contentText = array('chat_id' => $yulonglongBot->chatID(), "text" => 'Sorry, file does not exist.'); $yulonglongBot->sendMessage($contentText); } } else { $contentText = array("text" => 'Please define image name.'); $yulonglongBot->endpoint("sendMessage", $contentText, true); } } else { if ($yulonglongBot->isValidUserCommand("/psi")) { require_once 'inc/psiHelper.php'; $content = array("text" => getTextPsi("/psi")); $yulonglongBot->endpoint("sendMessage", $content, true); } else { if ($yulonglongBot->isValidUserCommand("/psi3")) { require_once 'inc/psiHelper.php'; $content = array("text" => getTextPsi("/psi3")); $yulonglongBot->endpoint("sendMessage", $content, true); } else { if ($yulonglongBot->isValidUserCommand("/psi24")) { require_once 'inc/psiHelper.php'; $content = array("text" => getTextPsi("/psi24")); $yulonglongBot->endpoint("sendMessage", $content, true); } else { if ($yulonglongBot->isValidUserCommand("/help")) { $yulonglongBot->sendHelp(); } else { $yulonglongBot->sendHelp(); } } } } } } } } } } } }