[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개
이런사람입니다. ^^
미투 !!
잘될거에요!
봇생성만 조금 어렵지 그다음은 쉬우니....
좋은자료 감사합니다 .!!
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 730 |
|
19년 전 | 2738 | |
| 729 |
그레이스웹
|
19년 전 | 3531 | |
| 728 |
|
19년 전 | 2717 | |
| 727 |
|
19년 전 | 2549 | |
| 726 |
|
19년 전 | 2367 | |
| 725 |
|
19년 전 | 2274 | |
| 724 |
|
19년 전 | 2159 | |
| 723 |
|
19년 전 | 4273 | |
| 722 |
|
19년 전 | 2701 | |
| 721 |
|
19년 전 | 2195 | |
| 720 |
|
19년 전 | 2292 | |
| 719 |
|
19년 전 | 2866 | |
| 718 |
|
19년 전 | 1978 | |
| 717 |
|
19년 전 | 3205 | |
| 716 |
|
19년 전 | 2768 | |
| 715 |
|
19년 전 | 2294 | |
| 714 |
|
19년 전 | 1847 | |
| 713 |
|
19년 전 | 2264 | |
| 712 |
|
19년 전 | 2023 | |
| 711 |
|
19년 전 | 1923 | |
| 710 |
|
19년 전 | 2494 | |
| 709 |
|
19년 전 | 2353 | |
| 708 |
|
19년 전 | 3906 | |
| 707 |
|
19년 전 | 3752 | |
| 706 |
|
19년 전 | 2259 | |
| 705 |
|
19년 전 | 3332 | |
| 704 |
|
19년 전 | 2007 | |
| 703 |
|
19년 전 | 2404 | |
| 702 |
|
19년 전 | 2300 | |
| 701 |
홀로남은자
|
19년 전 | 2363 | |
| 700 |
홀로남은자
|
19년 전 | 2189 | |
| 699 | 19년 전 | 2831 | ||
| 698 |
|
19년 전 | 2849 | |
| 697 |
|
19년 전 | 3190 | |
| 696 |
|
19년 전 | 3058 | |
| 695 |
|
19년 전 | 2731 | |
| 694 |
|
19년 전 | 2958 | |
| 693 |
|
19년 전 | 3212 | |
| 692 |
|
19년 전 | 2896 | |
| 691 |
|
19년 전 | 2647 | |
| 690 | 19년 전 | 2949 | ||
| 689 | 19년 전 | 4526 | ||
| 688 | 19년 전 | 2450 | ||
| 687 | 19년 전 | 2476 | ||
| 686 | 19년 전 | 3504 | ||
| 685 | 19년 전 | 3186 | ||
| 684 | 19년 전 | 2859 | ||
| 683 | 19년 전 | 2080 | ||
| 682 | 19년 전 | 1788 | ||
| 681 | 19년 전 | 2887 | ||
| 680 | 19년 전 | 1738 | ||
| 679 | 19년 전 | 2325 | ||
| 678 | 19년 전 | 3974 | ||
| 677 | 19년 전 | 3763 | ||
| 676 | 19년 전 | 3485 | ||
| 675 | 19년 전 | 3421 | ||
| 674 |
|
19년 전 | 1583 | |
| 673 |
|
19년 전 | 1942 | |
| 672 |
|
19년 전 | 1873 | |
| 671 | 19년 전 | 2539 | ||
| 670 | 19년 전 | 4655 | ||
| 669 |
|
19년 전 | 2783 | |
| 668 |
|
19년 전 | 1936 | |
| 667 |
|
19년 전 | 1956 | |
| 666 |
|
19년 전 | 1861 | |
| 665 |
|
19년 전 | 2597 | |
| 664 |
|
19년 전 | 8197 | |
| 663 |
|
19년 전 | 2750 | |
| 662 |
|
19년 전 | 2804 | |
| 661 |
|
19년 전 | 3064 | |
| 660 |
|
19년 전 | 2237 | |
| 659 |
|
19년 전 | 2261 | |
| 658 |
|
19년 전 | 2195 | |
| 657 |
|
19년 전 | 2098 | |
| 656 |
|
19년 전 | 2292 | |
| 655 |
|
19년 전 | 2547 | |
| 654 |
|
19년 전 | 3090 | |
| 653 | 19년 전 | 2343 | ||
| 652 | 19년 전 | 1929 | ||
| 651 |
|
19년 전 | 2871 | |
| 650 | 19년 전 | 5031 | ||
| 649 | 19년 전 | 3528 | ||
| 648 | 19년 전 | 3483 | ||
| 647 | 19년 전 | 2989 | ||
| 646 | 19년 전 | 2425 | ||
| 645 | 19년 전 | 1511 | ||
| 644 | 19년 전 | 3150 | ||
| 643 | 19년 전 | 2028 | ||
| 642 |
|
19년 전 | 5409 | |
| 641 | 19년 전 | 2447 | ||
| 640 | 19년 전 | 3445 | ||
| 639 | 19년 전 | 2884 | ||
| 638 | 19년 전 | 1771 | ||
| 637 | 19년 전 | 3887 | ||
| 636 | 19년 전 | 2437 | ||
| 635 | 19년 전 | 2326 | ||
| 634 |
|
19년 전 | 3029 | |
| 633 |
|
19년 전 | 3315 | |
| 632 | 19년 전 | 2524 | ||
| 631 | 19년 전 | 2283 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기