[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년 전 | 365 | ||
| 7929 | 9년 전 | 258 | ||
| 7928 | 9년 전 | 367 | ||
| 7927 | 9년 전 | 295 | ||
| 7926 | 9년 전 | 641 | ||
| 7925 | 9년 전 | 311 | ||
| 7924 | 9년 전 | 282 | ||
| 7923 | 9년 전 | 320 | ||
| 7922 | 9년 전 | 339 | ||
| 7921 | 9년 전 | 372 | ||
| 7920 | 9년 전 | 293 | ||
| 7919 | 9년 전 | 309 | ||
| 7918 | 9년 전 | 473 | ||
| 7917 | 9년 전 | 311 | ||
| 7916 | 9년 전 | 378 | ||
| 7915 | 9년 전 | 363 | ||
| 7914 | 9년 전 | 379 | ||
| 7913 | 9년 전 | 500 | ||
| 7912 | 9년 전 | 374 | ||
| 7911 | 9년 전 | 329 | ||
| 7910 | 9년 전 | 359 | ||
| 7909 | 9년 전 | 469 | ||
| 7908 | 9년 전 | 366 | ||
| 7907 | 9년 전 | 317 | ||
| 7906 | 9년 전 | 334 | ||
| 7905 | 9년 전 | 326 | ||
| 7904 | 9년 전 | 295 | ||
| 7903 | 9년 전 | 290 | ||
| 7902 | 9년 전 | 509 | ||
| 7901 |
|
9년 전 | 716 | |
| 7900 | 9년 전 | 536 | ||
| 7899 | 9년 전 | 344 | ||
| 7898 | 9년 전 | 337 | ||
| 7897 | 9년 전 | 295 | ||
| 7896 | 9년 전 | 314 | ||
| 7895 | 9년 전 | 423 | ||
| 7894 | 9년 전 | 346 | ||
| 7893 | 9년 전 | 275 | ||
| 7892 | 9년 전 | 322 | ||
| 7891 | 9년 전 | 707 | ||
| 7890 | 9년 전 | 1171 | ||
| 7889 | 9년 전 | 729 | ||
| 7888 |
limsy1987
|
9년 전 | 522 | |
| 7887 | 9년 전 | 499 | ||
| 7886 | 9년 전 | 383 | ||
| 7885 | 9년 전 | 358 | ||
| 7884 | 9년 전 | 365 | ||
| 7883 | 9년 전 | 345 | ||
| 7882 | 9년 전 | 359 | ||
| 7881 | 9년 전 | 386 | ||
| 7880 | 9년 전 | 513 | ||
| 7879 | 9년 전 | 410 | ||
| 7878 | 9년 전 | 1153 | ||
| 7877 | 9년 전 | 705 | ||
| 7876 | 9년 전 | 432 | ||
| 7875 | 9년 전 | 505 | ||
| 7874 |
|
9년 전 | 778 | |
| 7873 | 9년 전 | 480 | ||
| 7872 | 9년 전 | 611 | ||
| 7871 | 9년 전 | 443 | ||
| 7870 | 9년 전 | 565 | ||
| 7869 | 9년 전 | 384 | ||
| 7868 | 9년 전 | 377 | ||
| 7867 | 9년 전 | 378 | ||
| 7866 | 9년 전 | 436 | ||
| 7865 | 9년 전 | 394 | ||
| 7864 | 9년 전 | 457 | ||
| 7863 | 9년 전 | 450 | ||
| 7862 | 9년 전 | 426 | ||
| 7861 | 9년 전 | 587 | ||
| 7860 | 9년 전 | 593 | ||
| 7859 | 9년 전 | 362 | ||
| 7858 | 9년 전 | 670 | ||
| 7857 | 9년 전 | 1020 | ||
| 7856 | 9년 전 | 482 | ||
| 7855 | 9년 전 | 696 | ||
| 7854 | 9년 전 | 695 | ||
| 7853 | 9년 전 | 530 | ||
| 7852 | 9년 전 | 470 | ||
| 7851 | 9년 전 | 445 | ||
| 7850 | 9년 전 | 540 | ||
| 7849 | 9년 전 | 312 | ||
| 7848 | 9년 전 | 361 | ||
| 7847 | 9년 전 | 586 | ||
| 7846 | 9년 전 | 402 | ||
| 7845 | 9년 전 | 366 | ||
| 7844 | 9년 전 | 364 | ||
| 7843 | 9년 전 | 368 | ||
| 7842 | 9년 전 | 366 | ||
| 7841 | 9년 전 | 353 | ||
| 7840 | 9년 전 | 358 | ||
| 7839 | 9년 전 | 392 | ||
| 7838 | 9년 전 | 477 | ||
| 7837 | 9년 전 | 317 | ||
| 7836 | 9년 전 | 356 | ||
| 7835 | 9년 전 | 437 | ||
| 7834 |
|
9년 전 | 1167 | |
| 7833 | 9년 전 | 373 | ||
| 7832 | 9년 전 | 363 | ||
| 7831 | 9년 전 | 500 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기