[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개
이런사람입니다. ^^
미투 !!
잘될거에요!
봇생성만 조금 어렵지 그다음은 쉬우니....
좋은자료 감사합니다 .!!
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 230 | 20년 전 | 2060 | ||
| 229 | 20년 전 | 3135 | ||
| 228 | 20년 전 | 3322 | ||
| 227 | 20년 전 | 2393 | ||
| 226 | 20년 전 | 5475 | ||
| 225 | 20년 전 | 2520 | ||
| 224 | 20년 전 | 2967 | ||
| 223 | 20년 전 | 4204 | ||
| 222 | 20년 전 | 2604 | ||
| 221 | 20년 전 | 2289 | ||
| 220 | 20년 전 | 3676 | ||
| 219 | 20년 전 | 2070 | ||
| 218 | 20년 전 | 3564 | ||
| 217 | 20년 전 | 2477 | ||
| 216 | 20년 전 | 2910 | ||
| 215 | 20년 전 | 2225 | ||
| 214 | 20년 전 | 3335 | ||
| 213 | 20년 전 | 2916 | ||
| 212 | 20년 전 | 3048 | ||
| 211 | 20년 전 | 2145 | ||
| 210 | 20년 전 | 1893 | ||
| 209 | 20년 전 | 2352 | ||
| 208 | 20년 전 | 1975 | ||
| 207 | 20년 전 | 1673 | ||
| 206 | 20년 전 | 1855 | ||
| 205 | 20년 전 | 3948 | ||
| 204 | 20년 전 | 1672 | ||
| 203 | 20년 전 | 2010 | ||
| 202 | 20년 전 | 2357 | ||
| 201 | 20년 전 | 1824 | ||
| 200 | 20년 전 | 2955 | ||
| 199 | 20년 전 | 2004 | ||
| 198 | 20년 전 | 2084 | ||
| 197 | 20년 전 | 3650 | ||
| 196 | 20년 전 | 2980 | ||
| 195 | 20년 전 | 2092 | ||
| 194 | 20년 전 | 10243 | ||
| 193 | 20년 전 | 2243 | ||
| 192 | 20년 전 | 1600 | ||
| 191 | 20년 전 | 2663 | ||
| 190 | 20년 전 | 2290 | ||
| 189 | 20년 전 | 1679 | ||
| 188 | 20년 전 | 1476 | ||
| 187 | 20년 전 | 1903 | ||
| 186 | 20년 전 | 1710 | ||
| 185 | 20년 전 | 1757 | ||
| 184 | 20년 전 | 2348 | ||
| 183 | 20년 전 | 1561 | ||
| 182 | 20년 전 | 1484 | ||
| 181 | 20년 전 | 1623 | ||
| 180 | 20년 전 | 2717 | ||
| 179 | 20년 전 | 1802 | ||
| 178 | 20년 전 | 1857 | ||
| 177 | 20년 전 | 1981 | ||
| 176 | 20년 전 | 1801 | ||
| 175 | 20년 전 | 1871 | ||
| 174 | 20년 전 | 1694 | ||
| 173 | 20년 전 | 2058 | ||
| 172 | 20년 전 | 1785 | ||
| 171 | 20년 전 | 2557 | ||
| 170 | 20년 전 | 2268 | ||
| 169 | 20년 전 | 2550 | ||
| 168 | 20년 전 | 1478 | ||
| 167 | 20년 전 | 1578 | ||
| 166 | 20년 전 | 2153 | ||
| 165 | 20년 전 | 1627 | ||
| 164 | 20년 전 | 3768 | ||
| 163 | 20년 전 | 2662 | ||
| 162 | 20년 전 | 2081 | ||
| 161 | 20년 전 | 2787 | ||
| 160 | 20년 전 | 1732 | ||
| 159 | 20년 전 | 1609 | ||
| 158 | 20년 전 | 2561 | ||
| 157 | 20년 전 | 1488 | ||
| 156 | 20년 전 | 1737 | ||
| 155 | 20년 전 | 3227 | ||
| 154 | 20년 전 | 1894 | ||
| 153 | 20년 전 | 1622 | ||
| 152 | 20년 전 | 4950 | ||
| 151 | 20년 전 | 4576 | ||
| 150 | 20년 전 | 3513 | ||
| 149 | 20년 전 | 3791 | ||
| 148 | 20년 전 | 7071 | ||
| 147 | 20년 전 | 3549 | ||
| 146 | 20년 전 | 2619 | ||
| 145 | 20년 전 | 2613 | ||
| 144 | 20년 전 | 7166 | ||
| 143 | 20년 전 | 4598 | ||
| 142 | 20년 전 | 1900 | ||
| 141 | 20년 전 | 3251 | ||
| 140 | 20년 전 | 1958 | ||
| 139 | 20년 전 | 1574 | ||
| 138 | 20년 전 | 2306 | ||
| 137 | 20년 전 | 1777 | ||
| 136 | 20년 전 | 1453 | ||
| 135 | 20년 전 | 1784 | ||
| 134 | 20년 전 | 2966 | ||
| 133 | 20년 전 | 2448 | ||
| 132 | 20년 전 | 1705 | ||
| 131 | 20년 전 | 1637 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기