yeonghoon.kim

  • 게시판
  • 갤러리
  • aws

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

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

<?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 1613
공지 현금, 저축, 투자, 지출, 예산, 보험 내역(2024-05-30) 김영훈 2024.03.10 1321
» 간단 텔레그램 메세지 전송 php 김영훈 2022.08.10 366
65 docker-compose mariadb 샘플 김영훈 2022.08.11 379
64 opendkim-genkey 임의 서브도메인 지정 김영훈 2022.08.12 287
63 NCP - SourceCommit 저장소 생성 file 김영훈 2022.08.18 352
62 우분투 22.04 remove.bg 설치 김영훈 2022.09.22 373
61 CentOS7 EUC-KR 로케일 설정 김영훈 2022.10.20 339
60 CentOS8-Stream packstack 설치 [5] 김영훈 2022.11.24 443
59 Centos Console 화면 보호기 setterm 김영훈 2022.11.26 273
58 mac에서 centos6 ssh 접속 시 오류 - no matching host key type found. Their offer: ssh-rsa,ssh-dss 김영훈 2022.11.27 439
57 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 546
56 centos7 gitlab 설치 김영훈 2022.11.28 371
55 mac homebrew 설치 김영훈 2022.11.30 268
54 growpart - no tools available to resize disk with 'gpt' 김영훈 2022.12.01 310
53 CentOS7 - minikube 설치 김영훈 2022.12.02 437
52 CentOS7 아나콘다 환경에 주피터 노트북 설치 김영훈 2022.12.03 696
51 python - random 라이브러리 김영훈 2022.12.19 344
50 python - socket 라이브러리 김영훈 2022.12.19 388
49 python - requests 라이브러리 김영훈 2022.12.19 302
48 python - re 라이브러리 김영훈 2022.12.19 386
47 Uptime Kuma용 push(패시브) 체크용 파일.py [1] 김영훈 2022.12.21 356
쓰기 태그
 첫 페이지 5 6 7 8 9 10 11 12 13 14 끝 페이지