<?php
/*
 * https://yeonghoon.kim/telegram_msg.php?msg=내용&token=token
 * hostname은 option
 */
$bot_id = 'bot_id';
$chat_id = 'chat_id';
$send_url = "https://api.telegram.org/bot${bot_id}/sendmessage?chat_id=${chat_id}&text=";
$remote_ip = $_SERVER["REMOTE_ADDR"];
$msg = $_REQUEST['msg'];
$hostname = $_REQUEST['hostname'];
$token = $_REQUEST['token'];
if($remote_ip && $msg && $token == 'token') {
    $content = urlencode("[ $remote_ip ] $hostname
$msg");
    echo file_get_contents($send_url.$content);
    exit();
}
http_response_code(404);
exit();
?>