[code]
<?php
/*
https://telegram.me/botfather 접속하여 봇아빠를 채팅창에 호출 하고 다음 커맨드를 입력
-------------------------------
봇이름 /newbot
봇실재아이디(끝에 bot을 붙여준다)
/token
/setabouttext
봇정보 안내문구
/setdescription
접속문구
-------------------------------
token이 바로 api
*/
header('Content-Type: text/html; charset=utf-8');
# 기본환경설정
define('TOKEN_KEY','');
define('BASE_URL', 'https://api.telegram.org/bot'.TOKEN_KEY);
# CURL Function
function GetCurl($url, $data=array()) {
// 서버로 전송 및 결과 반환
$rest = curl_init();
curl_setopt($rest, CURLOPT_URL, $url);
curl_setopt($rest, CURLOPT_POST, false);
curl_setopt($rest, CURLOPT_RETURNTRANSFER, true);
$Result = curl_exec($rest);
curl_close($rest);
return json_decode($Result, true);
}
if($_GET['type'] == 'room') {
# 채팅룸 추출
$Room = GetCurl(BASE_URL.'/getUpdates?limit=100');
$Room_id = array();
foreach($Room['result'] as $k=>$v) {
$Room_id[] = $v['message']['chat']['id'];
}
$Room_id = array_unique($Room_id);
$Room_id = array_values($Room_id);
var_dump($Room_id);
echo '<hr>';
var_dump($Room);
} else {
# 지정발송
if($_GET['room_id']) $Room_id = $_GET['room_id'];
else $Room_id = array('52227374','119732868', '84094887');
if($_GET['msg']) $msg = $_GET['msg'];
else $msg = date('Y-m-d H:i:s');
if(sizeof($Room_id) > 0) {
# 발송하기
foreach($Room_id as $k=>$v) {
$Result = GetCurl(BASE_URL.'/sendMessage?chat_id='.$v.'&text='.urlencode($msg));
print_r($Result);
echo '<hr>';
}
}
else if(is_array($Room_id) === false && $Room_id) {
$Result = GetCurl(BASE_URL.'/sendMessage?chat_id='.$Room_id.'&text='.urlencode($msg));
print_r($Result);
echo '<hr>';
}
}
[/code]

이런분안계시겠죠?
댓글 10개
이런사람입니다. ^^
미투 !!
잘될거에요!
봇생성만 조금 어렵지 그다음은 쉬우니....
좋은자료 감사합니다 .!!
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 6730 |
|
11년 전 | 1103 | |
| 6729 | 11년 전 | 558 | ||
| 6728 |
|
11년 전 | 568 | |
| 6727 | 11년 전 | 2411 | ||
| 6726 | 11년 전 | 594 | ||
| 6725 |
네모웹에이전시
|
11년 전 | 426 | |
| 6724 |
네모웹에이전시
|
11년 전 | 880 | |
| 6723 | 11년 전 | 1011 | ||
| 6722 | 11년 전 | 957 | ||
| 6721 | 11년 전 | 639 | ||
| 6720 | 11년 전 | 1969 | ||
| 6719 | 11년 전 | 2191 | ||
| 6718 | 11년 전 | 1087 | ||
| 6717 |
|
11년 전 | 646 | |
| 6716 | 11년 전 | 2309 | ||
| 6715 | 11년 전 | 7577 | ||
| 6714 | 11년 전 | 2039 | ||
| 6713 | 11년 전 | 772 | ||
| 6712 |
geektoo
|
11년 전 | 1143 | |
| 6711 | 11년 전 | 888 | ||
| 6710 |
sirzzang
|
11년 전 | 2122 | |
| 6709 |
bewitched
|
11년 전 | 1795 | |
| 6708 |
levin
|
11년 전 | 560 | |
| 6707 | 11년 전 | 764 | ||
| 6706 | 11년 전 | 1783 | ||
| 6705 | 11년 전 | 983 | ||
| 6704 |
|
11년 전 | 751 | |
| 6703 | 11년 전 | 411 | ||
| 6702 | 11년 전 | 1088 | ||
| 6701 | 11년 전 | 799 | ||
| 6700 | 11년 전 | 1716 | ||
| 6699 | 11년 전 | 712 | ||
| 6698 |
이박사친구
|
11년 전 | 721 | |
| 6697 | 11년 전 | 1211 | ||
| 6696 | 11년 전 | 616 | ||
| 6695 |
Header
|
11년 전 | 701 | |
| 6694 | 11년 전 | 1156 | ||
| 6693 |
|
11년 전 | 1101 | |
| 6692 | 11년 전 | 1133 | ||
| 6691 | 11년 전 | 1283 | ||
| 6690 |
|
11년 전 | 708 | |
| 6689 | 11년 전 | 890 | ||
| 6688 | 11년 전 | 922 | ||
| 6687 | 11년 전 | 529 | ||
| 6686 |
RGB255
|
11년 전 | 961 | |
| 6685 |
|
11년 전 | 635 | |
| 6684 | 11년 전 | 716 | ||
| 6683 | 11년 전 | 379 | ||
| 6682 | 11년 전 | 1121 | ||
| 6681 | 11년 전 | 1407 | ||
| 6680 | 11년 전 | 432 | ||
| 6679 |
RGB255
|
11년 전 | 378 | |
| 6678 | 11년 전 | 1342 | ||
| 6677 |
|
11년 전 | 425 | |
| 6676 | 11년 전 | 1011 | ||
| 6675 |
디자이너필이
|
11년 전 | 817 | |
| 6674 | 11년 전 | 1239 | ||
| 6673 | 11년 전 | 1310 | ||
| 6672 | 11년 전 | 6017 | ||
| 6671 | 11년 전 | 1331 | ||
| 6670 |
하프의정령
|
11년 전 | 558 | |
| 6669 | 11년 전 | 411 | ||
| 6668 |
공부하고가겠슴다
|
11년 전 | 436 | |
| 6667 |
하프의정령
|
11년 전 | 542 | |
| 6666 | 11년 전 | 781 | ||
| 6665 | 11년 전 | 1407 | ||
| 6664 | 11년 전 | 911 | ||
| 6663 | 11년 전 | 1137 | ||
| 6662 | 11년 전 | 404 | ||
| 6661 |
basketball
|
11년 전 | 504 | |
| 6660 | 11년 전 | 2502 | ||
| 6659 | 11년 전 | 1598 | ||
| 6658 |
|
11년 전 | 1311 | |
| 6657 |
|
11년 전 | 3143 | |
| 6656 | 11년 전 | 556 | ||
| 6655 |
프로프리랜서
|
11년 전 | 2331 | |
| 6654 |
프로프리랜서
|
11년 전 | 1900 | |
| 6653 |
프로프리랜서
|
11년 전 | 1744 | |
| 6652 |
프로프리랜서
|
11년 전 | 1817 | |
| 6651 |
|
11년 전 | 768 | |
| 6650 | 11년 전 | 1311 | ||
| 6649 | 11년 전 | 1312 | ||
| 6648 | 11년 전 | 805 | ||
| 6647 | 11년 전 | 3153 | ||
| 6646 | 11년 전 | 457 | ||
| 6645 | 11년 전 | 957 | ||
| 6644 |
BBAYOUNG
|
11년 전 | 1359 | |
| 6643 | 11년 전 | 1779 | ||
| 6642 | 11년 전 | 630 | ||
| 6641 | 11년 전 | 1327 | ||
| 6640 | 11년 전 | 698 | ||
| 6639 | 11년 전 | 2316 | ||
| 6638 |
jasmin2
|
11년 전 | 741 | |
| 6637 |
geektoo
|
11년 전 | 436 | |
| 6636 | 11년 전 | 648 | ||
| 6635 |
프로프리랜서
|
11년 전 | 2220 | |
| 6634 |
프로프리랜서
|
11년 전 | 1736 | |
| 6633 |
프로프리랜서
|
11년 전 | 4056 | |
| 6632 |
프로프리랜서
|
11년 전 | 1343 | |
| 6631 |
프로프리랜서
|
11년 전 | 1775 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기