[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개
이런사람입니다. ^^
미투 !!
잘될거에요!
봇생성만 조금 어렵지 그다음은 쉬우니....
좋은자료 감사합니다 .!!
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 930 | 19년 전 | 3554 | ||
| 929 |
|
19년 전 | 2721 | |
| 928 |
|
19년 전 | 3462 | |
| 927 |
|
19년 전 | 3451 | |
| 926 |
|
19년 전 | 3152 | |
| 925 | 19년 전 | 5443 | ||
| 924 |
|
19년 전 | 2182 | |
| 923 |
|
19년 전 | 2240 | |
| 922 |
|
19년 전 | 2325 | |
| 921 |
|
19년 전 | 3419 | |
| 920 | 19년 전 | 3717 | ||
| 919 |
|
19년 전 | 3755 | |
| 918 |
|
19년 전 | 2379 | |
| 917 |
|
19년 전 | 2407 | |
| 916 |
|
19년 전 | 2720 | |
| 915 | 19년 전 | 3063 | ||
| 914 | 19년 전 | 2470 | ||
| 913 | 19년 전 | 2633 | ||
| 912 | 19년 전 | 2464 | ||
| 911 | 19년 전 | 2231 | ||
| 910 | 19년 전 | 3260 | ||
| 909 | 19년 전 | 3322 | ||
| 908 | 19년 전 | 3055 | ||
| 907 |
|
19년 전 | 4881 | |
| 906 |
|
19년 전 | 2722 | |
| 905 |
|
19년 전 | 3323 | |
| 904 |
|
19년 전 | 3165 | |
| 903 |
|
19년 전 | 2006 | |
| 902 |
|
19년 전 | 3159 | |
| 901 |
|
19년 전 | 1895 | |
| 900 |
|
19년 전 | 2351 | |
| 899 |
|
19년 전 | 2409 | |
| 898 |
|
19년 전 | 3998 | |
| 897 |
|
19년 전 | 3203 | |
| 896 |
|
19년 전 | 3114 | |
| 895 |
|
19년 전 | 2552 | |
| 894 |
|
19년 전 | 2029 | |
| 893 |
|
19년 전 | 1663 | |
| 892 |
|
19년 전 | 2427 | |
| 891 |
|
19년 전 | 2338 | |
| 890 |
|
19년 전 | 1822 | |
| 889 |
|
19년 전 | 1824 | |
| 888 |
|
19년 전 | 2619 | |
| 887 |
|
19년 전 | 2588 | |
| 886 |
|
19년 전 | 1880 | |
| 885 |
|
19년 전 | 2130 | |
| 884 |
|
19년 전 | 3317 | |
| 883 |
|
19년 전 | 1962 | |
| 882 |
|
19년 전 | 2515 | |
| 881 |
|
19년 전 | 2598 | |
| 880 |
|
19년 전 | 2673 | |
| 879 |
|
19년 전 | 2946 | |
| 878 |
|
19년 전 | 2567 | |
| 877 |
|
19년 전 | 2990 | |
| 876 |
|
19년 전 | 2767 | |
| 875 |
|
19년 전 | 3526 | |
| 874 | 19년 전 | 1880 | ||
| 873 | 19년 전 | 2748 | ||
| 872 |
|
19년 전 | 2385 | |
| 871 |
|
19년 전 | 2028 | |
| 870 |
|
19년 전 | 2434 | |
| 869 |
|
19년 전 | 1880 | |
| 868 |
|
19년 전 | 5450 | |
| 867 |
|
19년 전 | 2277 | |
| 866 |
|
19년 전 | 4277 | |
| 865 |
|
19년 전 | 2313 | |
| 864 | 19년 전 | 1867 | ||
| 863 | 19년 전 | 2622 | ||
| 862 | 19년 전 | 2341 | ||
| 861 | 19년 전 | 2539 | ||
| 860 | 19년 전 | 2177 | ||
| 859 | 19년 전 | 3931 | ||
| 858 | 19년 전 | 3430 | ||
| 857 | 19년 전 | 2212 | ||
| 856 |
Power
|
19년 전 | 2113 | |
| 855 | 19년 전 | 1976 | ||
| 854 | 19년 전 | 2011 | ||
| 853 |
pearly
|
19년 전 | 4416 | |
| 852 |
pearly
|
19년 전 | 3364 | |
| 851 | 19년 전 | 2787 | ||
| 850 |
pearly
|
19년 전 | 3361 | |
| 849 |
pearly
|
19년 전 | 3019 | |
| 848 |
pearly
|
19년 전 | 2858 | |
| 847 | 19년 전 | 2379 | ||
| 846 |
|
19년 전 | 2190 | |
| 845 |
pearly
|
19년 전 | 2509 | |
| 844 | 19년 전 | 3116 | ||
| 843 | 19년 전 | 2143 | ||
| 842 |
pearly
|
19년 전 | 3132 | |
| 841 |
pearly
|
19년 전 | 3255 | |
| 840 | 19년 전 | 2940 | ||
| 839 |
|
19년 전 | 1954 | |
| 838 |
|
19년 전 | 1717 | |
| 837 |
|
19년 전 | 2341 | |
| 836 |
|
19년 전 | 2288 | |
| 835 |
|
19년 전 | 1663 | |
| 834 |
|
19년 전 | 1674 | |
| 833 |
|
19년 전 | 1580 | |
| 832 |
|
19년 전 | 2073 | |
| 831 |
|
19년 전 | 1625 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기