[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개
이런사람입니다. ^^
미투 !!
잘될거에요!
봇생성만 조금 어렵지 그다음은 쉬우니....
좋은자료 감사합니다 .!!
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 430 | 19년 전 | 4097 | ||
| 429 | 19년 전 | 3296 | ||
| 428 | 19년 전 | 4132 | ||
| 427 | 19년 전 | 3467 | ||
| 426 | 19년 전 | 3101 | ||
| 425 | 19년 전 | 3403 | ||
| 424 | 19년 전 | 2438 | ||
| 423 | 19년 전 | 2860 | ||
| 422 | 19년 전 | 2347 | ||
| 421 | 19년 전 | 3705 | ||
| 420 | 19년 전 | 4734 | ||
| 419 | 19년 전 | 3793 | ||
| 418 |
|
19년 전 | 1741 | |
| 417 | 19년 전 | 2743 | ||
| 416 | 19년 전 | 2387 | ||
| 415 | 19년 전 | 2605 | ||
| 414 | 19년 전 | 4407 | ||
| 413 |
|
19년 전 | 2596 | |
| 412 | 19년 전 | 3045 | ||
| 411 |
|
19년 전 | 2991 | |
| 410 |
|
19년 전 | 3680 | |
| 409 |
|
19년 전 | 3631 | |
| 408 |
|
19년 전 | 1853 | |
| 407 | 19년 전 | 2226 | ||
| 406 | 19년 전 | 2780 | ||
| 405 | 19년 전 | 2442 | ||
| 404 | 19년 전 | 4297 | ||
| 403 | 19년 전 | 3300 | ||
| 402 |
NeoGenesis
|
19년 전 | 4088 | |
| 401 | 19년 전 | 2605 | ||
| 400 |
|
19년 전 | 2491 | |
| 399 | 19년 전 | 2953 | ||
| 398 | 19년 전 | 2483 | ||
| 397 | 19년 전 | 2778 | ||
| 396 | 19년 전 | 2470 | ||
| 395 | 19년 전 | 3176 | ||
| 394 | 19년 전 | 1715 | ||
| 393 | 19년 전 | 2989 | ||
| 392 | 19년 전 | 2249 | ||
| 391 | 19년 전 | 2176 | ||
| 390 | 19년 전 | 2283 | ||
| 389 | 19년 전 | 2642 | ||
| 388 | 19년 전 | 2172 | ||
| 387 | 19년 전 | 4484 | ||
| 386 |
|
19년 전 | 2689 | |
| 385 |
|
19년 전 | 2480 | |
| 384 | 19년 전 | 3007 | ||
| 383 | 19년 전 | 3050 | ||
| 382 | 19년 전 | 3103 | ||
| 381 |
|
19년 전 | 2629 | |
| 380 |
|
19년 전 | 3014 | |
| 379 | 19년 전 | 2545 | ||
| 378 | 19년 전 | 2205 | ||
| 377 | 19년 전 | 2776 | ||
| 376 | 19년 전 | 2467 | ||
| 375 |
|
19년 전 | 2555 | |
| 374 | 19년 전 | 3815 | ||
| 373 | 19년 전 | 3264 | ||
| 372 | 19년 전 | 4985 | ||
| 371 |
세은아빠2
|
19년 전 | 2412 | |
| 370 | 19년 전 | 4495 | ||
| 369 | 19년 전 | 3109 | ||
| 368 | 19년 전 | 2897 | ||
| 367 | 19년 전 | 3722 | ||
| 366 | 19년 전 | 2648 | ||
| 365 | 19년 전 | 3733 | ||
| 364 | 19년 전 | 4009 | ||
| 363 | 19년 전 | 3434 | ||
| 362 | 19년 전 | 3474 | ||
| 361 | 19년 전 | 4106 | ||
| 360 |
hwatta
|
19년 전 | 2359 | |
| 359 | 19년 전 | 5099 | ||
| 358 | 19년 전 | 3654 | ||
| 357 | 19년 전 | 2594 | ||
| 356 |
sdesign1s
|
19년 전 | 2274 | |
| 355 | 20년 전 | 2748 | ||
| 354 | 20년 전 | 3027 | ||
| 353 | 20년 전 | 2787 | ||
| 352 |
|
20년 전 | 5768 | |
| 351 |
|
20년 전 | 2700 | |
| 350 |
|
20년 전 | 4289 | |
| 349 |
hwatta
|
20년 전 | 2179 | |
| 348 | 20년 전 | 7306 | ||
| 347 | 20년 전 | 2412 | ||
| 346 | 20년 전 | 3501 | ||
| 345 | 20년 전 | 4305 | ||
| 344 | 20년 전 | 2642 | ||
| 343 | 20년 전 | 3918 | ||
| 342 | 20년 전 | 3064 | ||
| 341 | 20년 전 | 4084 | ||
| 340 |
|
20년 전 | 5137 | |
| 339 |
|
20년 전 | 4231 | |
| 338 | 20년 전 | 5867 | ||
| 337 | 20년 전 | 2042 | ||
| 336 |
|
20년 전 | 3314 | |
| 335 |
|
20년 전 | 3536 | |
| 334 |
|
20년 전 | 2918 | |
| 333 |
hwatta
|
20년 전 | 2430 | |
| 332 | 20년 전 | 4653 | ||
| 331 | 20년 전 | 2267 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기