yeonghoon.kim

  • 게시판
  • 갤러리
  • aws

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

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

<?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 2160
공지 현금, 저축, 투자, 지출, 예산, 보험 내역(2024-05-30) 김영훈 2024.03.10 1801
» 간단 텔레그램 메세지 전송 php 김영훈 2022.08.10 620
66 docker-compose mariadb 샘플 김영훈 2022.08.11 661
65 opendkim-genkey 임의 서브도메인 지정 김영훈 2022.08.12 368
64 NCP - SourceCommit 저장소 생성 file 김영훈 2022.08.18 593
63 우분투 22.04 remove.bg 설치 김영훈 2022.09.22 617
62 CentOS7 EUC-KR 로케일 설정 김영훈 2022.10.20 515
61 CentOS8-Stream packstack 설치 [5] 김영훈 2022.11.24 717
60 Centos Console 화면 보호기 setterm 김영훈 2022.11.26 380
59 mac에서 centos6 ssh 접속 시 오류 - no matching host key type found. Their offer: ssh-rsa,ssh-dss 김영훈 2022.11.27 581
58 Your account is pending approval from your GitLab administrator and hence blocked. Please contact your GitLab administrator if you think this is an error. 김영훈 2022.11.28 738
57 centos7 gitlab 설치 김영훈 2022.11.28 496
56 mac homebrew 설치 김영훈 2022.11.30 355
55 growpart - no tools available to resize disk with 'gpt' 김영훈 2022.12.01 416
54 CentOS7 - minikube 설치 김영훈 2022.12.02 593
53 CentOS7 아나콘다 환경에 주피터 노트북 설치 김영훈 2022.12.03 827
52 python - random 라이브러리 김영훈 2022.12.19 652
51 python - socket 라이브러리 김영훈 2022.12.19 800
50 python - requests 라이브러리 김영훈 2022.12.19 402
49 python - re 라이브러리 김영훈 2022.12.19 510
48 Uptime Kuma용 push(패시브) 체크용 파일.py [1] 김영훈 2022.12.21 593
쓰기 태그
 첫 페이지 5 6 7 8 9 10 11 12 13 14 끝 페이지