yeonghoon.kim

  • 게시판
  • 갤러리
  • aws

간단 텔레그램 메세지 전송 php

김영훈 2022.08.10 11:30 조회 수 : 761

<?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();
?>


  • 추천 0

  • 비추천 0
이 게시물을
목록

댓글 0

번호 제목 글쓴이 날짜 조회 수
공지 2025 일본 여행 계획 김영훈 2024.10.10 2794
공지 현금, 저축, 투자, 지출, 예산, 보험 내역(2024-05-30) 김영훈 2024.03.10 2309
208 Centos Console 화면 보호기 setterm 김영훈 2022.11.26 435
207 CentOS8-Stream packstack 설치 [5] 김영훈 2022.11.24 1486
206 CentOS7 EUC-KR 로케일 설정 김영훈 2022.10.20 863
205 우분투 22.04 remove.bg 설치 김영훈 2022.09.22 1420
204 NCP - SourceCommit 저장소 생성 file 김영훈 2022.08.18 830
203 opendkim-genkey 임의 서브도메인 지정 김영훈 2022.08.12 471
202 docker-compose mariadb 샘플 김영훈 2022.08.11 898
» 간단 텔레그램 메세지 전송 php 김영훈 2022.08.10 761
200 오라클 클라우드 RDNS 요청 방법 file 김영훈 2022.08.10 536
199 리눅스 이미지 퀄리티 일괄 변경(ImageMagick 이용) 김영훈 2022.08.08 505
198 OCI CLI 이용하여 아카이브 스토리지 파일 제어 김영훈 2022.08.02 1562
197 오라클 클라우드 서버 백업 스크립트(+아카이브 스토리지 업로드) 김영훈 2022.08.02 1333
196 nc 소스 설치(yum 안되는 환경) 김영훈 2022.08.02 427
195 pigz (다중 코어 압축) 사용법 김영훈 2022.08.02 639
194 우분투 22.04 nagios 설치(마스터 서버) 김영훈 2022.08.01 1178
193 tron_ubuntu20.04 김영훈 2021.12.25 1365
192 bitcoin_core_ubuntu20.04 김영훈 2021.12.25 1787
191 go_ethereum_ubuntu20.04 김영훈 2021.12.25 622
190 MBR to GPT, 디스크 용량 확장 김영훈 2021.12.17 1635
189 인텔 11세대 RST 드라이버(윈도우 10 설치시 필요) 김영훈 2021.10.21 496
쓰기 태그
 첫 페이지 1 2 3 4 5 6 7 8 9 10 끝 페이지