[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개
이런사람입니다. ^^
미투 !!
잘될거에요!
봇생성만 조금 어렵지 그다음은 쉬우니....
좋은자료 감사합니다 .!!
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7930 | 9년 전 | 381 | ||
| 7929 | 9년 전 | 274 | ||
| 7928 | 9년 전 | 383 | ||
| 7927 | 9년 전 | 304 | ||
| 7926 | 9년 전 | 649 | ||
| 7925 | 9년 전 | 324 | ||
| 7924 | 9년 전 | 301 | ||
| 7923 | 9년 전 | 325 | ||
| 7922 | 9년 전 | 349 | ||
| 7921 | 9년 전 | 379 | ||
| 7920 | 9년 전 | 301 | ||
| 7919 | 9년 전 | 317 | ||
| 7918 | 9년 전 | 478 | ||
| 7917 | 9년 전 | 319 | ||
| 7916 | 9년 전 | 386 | ||
| 7915 | 9년 전 | 376 | ||
| 7914 | 9년 전 | 389 | ||
| 7913 | 9년 전 | 513 | ||
| 7912 | 9년 전 | 387 | ||
| 7911 | 9년 전 | 335 | ||
| 7910 | 9년 전 | 372 | ||
| 7909 | 9년 전 | 476 | ||
| 7908 | 9년 전 | 377 | ||
| 7907 | 9년 전 | 333 | ||
| 7906 | 9년 전 | 347 | ||
| 7905 | 9년 전 | 338 | ||
| 7904 | 9년 전 | 310 | ||
| 7903 | 9년 전 | 311 | ||
| 7902 | 9년 전 | 523 | ||
| 7901 |
|
9년 전 | 721 | |
| 7900 | 9년 전 | 548 | ||
| 7899 | 9년 전 | 352 | ||
| 7898 | 9년 전 | 346 | ||
| 7897 | 9년 전 | 302 | ||
| 7896 | 9년 전 | 330 | ||
| 7895 | 9년 전 | 433 | ||
| 7894 | 9년 전 | 359 | ||
| 7893 | 9년 전 | 295 | ||
| 7892 | 9년 전 | 343 | ||
| 7891 | 9년 전 | 728 | ||
| 7890 | 9년 전 | 1180 | ||
| 7889 | 9년 전 | 738 | ||
| 7888 |
limsy1987
|
9년 전 | 532 | |
| 7887 | 9년 전 | 514 | ||
| 7886 | 9년 전 | 399 | ||
| 7885 | 9년 전 | 372 | ||
| 7884 | 9년 전 | 379 | ||
| 7883 | 9년 전 | 368 | ||
| 7882 | 9년 전 | 385 | ||
| 7881 | 9년 전 | 407 | ||
| 7880 | 9년 전 | 530 | ||
| 7879 | 9년 전 | 426 | ||
| 7878 | 9년 전 | 1169 | ||
| 7877 | 9년 전 | 721 | ||
| 7876 | 9년 전 | 447 | ||
| 7875 | 9년 전 | 524 | ||
| 7874 |
|
9년 전 | 786 | |
| 7873 | 9년 전 | 486 | ||
| 7872 | 9년 전 | 626 | ||
| 7871 | 9년 전 | 454 | ||
| 7870 | 9년 전 | 581 | ||
| 7869 | 9년 전 | 397 | ||
| 7868 | 9년 전 | 394 | ||
| 7867 | 9년 전 | 391 | ||
| 7866 | 9년 전 | 454 | ||
| 7865 | 9년 전 | 412 | ||
| 7864 | 9년 전 | 475 | ||
| 7863 | 9년 전 | 466 | ||
| 7862 | 9년 전 | 441 | ||
| 7861 | 9년 전 | 599 | ||
| 7860 | 9년 전 | 598 | ||
| 7859 | 9년 전 | 375 | ||
| 7858 | 9년 전 | 680 | ||
| 7857 | 9년 전 | 1034 | ||
| 7856 | 9년 전 | 493 | ||
| 7855 | 9년 전 | 712 | ||
| 7854 | 9년 전 | 703 | ||
| 7853 | 9년 전 | 555 | ||
| 7852 | 9년 전 | 475 | ||
| 7851 | 9년 전 | 457 | ||
| 7850 | 9년 전 | 558 | ||
| 7849 | 9년 전 | 327 | ||
| 7848 | 9년 전 | 378 | ||
| 7847 | 9년 전 | 598 | ||
| 7846 | 9년 전 | 421 | ||
| 7845 | 9년 전 | 378 | ||
| 7844 | 9년 전 | 370 | ||
| 7843 | 9년 전 | 383 | ||
| 7842 | 9년 전 | 372 | ||
| 7841 | 9년 전 | 359 | ||
| 7840 | 9년 전 | 367 | ||
| 7839 | 9년 전 | 406 | ||
| 7838 | 9년 전 | 488 | ||
| 7837 | 9년 전 | 332 | ||
| 7836 | 9년 전 | 368 | ||
| 7835 | 9년 전 | 448 | ||
| 7834 |
|
9년 전 | 1176 | |
| 7833 | 9년 전 | 388 | ||
| 7832 | 9년 전 | 388 | ||
| 7831 | 9년 전 | 521 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기