[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년 전 | 384 | ||
| 7929 | 9년 전 | 284 | ||
| 7928 | 9년 전 | 390 | ||
| 7927 | 9년 전 | 312 | ||
| 7926 | 9년 전 | 652 | ||
| 7925 | 9년 전 | 329 | ||
| 7924 | 9년 전 | 311 | ||
| 7923 | 9년 전 | 330 | ||
| 7922 | 9년 전 | 349 | ||
| 7921 | 9년 전 | 382 | ||
| 7920 | 9년 전 | 303 | ||
| 7919 | 9년 전 | 322 | ||
| 7918 | 9년 전 | 479 | ||
| 7917 | 9년 전 | 322 | ||
| 7916 | 9년 전 | 390 | ||
| 7915 | 9년 전 | 385 | ||
| 7914 | 9년 전 | 393 | ||
| 7913 | 9년 전 | 527 | ||
| 7912 | 9년 전 | 391 | ||
| 7911 | 9년 전 | 339 | ||
| 7910 | 9년 전 | 376 | ||
| 7909 | 9년 전 | 480 | ||
| 7908 | 9년 전 | 389 | ||
| 7907 | 9년 전 | 339 | ||
| 7906 | 9년 전 | 358 | ||
| 7905 | 9년 전 | 341 | ||
| 7904 | 9년 전 | 317 | ||
| 7903 | 9년 전 | 318 | ||
| 7902 | 9년 전 | 529 | ||
| 7901 |
|
9년 전 | 722 | |
| 7900 | 9년 전 | 554 | ||
| 7899 | 9년 전 | 356 | ||
| 7898 | 9년 전 | 358 | ||
| 7897 | 9년 전 | 310 | ||
| 7896 | 9년 전 | 340 | ||
| 7895 | 9년 전 | 442 | ||
| 7894 | 9년 전 | 362 | ||
| 7893 | 9년 전 | 303 | ||
| 7892 | 9년 전 | 357 | ||
| 7891 | 9년 전 | 732 | ||
| 7890 | 9년 전 | 1182 | ||
| 7889 | 9년 전 | 738 | ||
| 7888 |
limsy1987
|
9년 전 | 532 | |
| 7887 | 9년 전 | 521 | ||
| 7886 | 9년 전 | 410 | ||
| 7885 | 9년 전 | 380 | ||
| 7884 | 9년 전 | 383 | ||
| 7883 | 9년 전 | 375 | ||
| 7882 | 9년 전 | 399 | ||
| 7881 | 9년 전 | 411 | ||
| 7880 | 9년 전 | 537 | ||
| 7879 | 9년 전 | 433 | ||
| 7878 | 9년 전 | 1181 | ||
| 7877 | 9년 전 | 726 | ||
| 7876 | 9년 전 | 455 | ||
| 7875 | 9년 전 | 533 | ||
| 7874 |
|
9년 전 | 790 | |
| 7873 | 9년 전 | 491 | ||
| 7872 | 9년 전 | 644 | ||
| 7871 | 9년 전 | 459 | ||
| 7870 | 9년 전 | 588 | ||
| 7869 | 9년 전 | 401 | ||
| 7868 | 9년 전 | 406 | ||
| 7867 | 9년 전 | 400 | ||
| 7866 | 9년 전 | 465 | ||
| 7865 | 9년 전 | 418 | ||
| 7864 | 9년 전 | 481 | ||
| 7863 | 9년 전 | 478 | ||
| 7862 | 9년 전 | 446 | ||
| 7861 | 9년 전 | 607 | ||
| 7860 | 9년 전 | 603 | ||
| 7859 | 9년 전 | 383 | ||
| 7858 | 9년 전 | 683 | ||
| 7857 | 9년 전 | 1041 | ||
| 7856 | 9년 전 | 493 | ||
| 7855 | 9년 전 | 720 | ||
| 7854 | 9년 전 | 706 | ||
| 7853 | 9년 전 | 560 | ||
| 7852 | 9년 전 | 480 | ||
| 7851 | 9년 전 | 468 | ||
| 7850 | 9년 전 | 564 | ||
| 7849 | 9년 전 | 332 | ||
| 7848 | 9년 전 | 383 | ||
| 7847 | 9년 전 | 608 | ||
| 7846 | 9년 전 | 430 | ||
| 7845 | 9년 전 | 386 | ||
| 7844 | 9년 전 | 373 | ||
| 7843 | 9년 전 | 387 | ||
| 7842 | 9년 전 | 376 | ||
| 7841 | 9년 전 | 363 | ||
| 7840 | 9년 전 | 372 | ||
| 7839 | 9년 전 | 412 | ||
| 7838 | 9년 전 | 493 | ||
| 7837 | 9년 전 | 334 | ||
| 7836 | 9년 전 | 374 | ||
| 7835 | 9년 전 | 451 | ||
| 7834 |
|
9년 전 | 1176 | |
| 7833 | 9년 전 | 391 | ||
| 7832 | 9년 전 | 392 | ||
| 7831 | 9년 전 | 527 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기