[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개
이런사람입니다. ^^
미투 !!
잘될거에요!
봇생성만 조금 어렵지 그다음은 쉬우니....
좋은자료 감사합니다 .!!
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 8030 | 9년 전 | 356 | ||
| 8029 | 9년 전 | 289 | ||
| 8028 | 9년 전 | 255 | ||
| 8027 | 9년 전 | 267 | ||
| 8026 | 9년 전 | 314 | ||
| 8025 | 9년 전 | 367 | ||
| 8024 | 9년 전 | 333 | ||
| 8023 | 9년 전 | 381 | ||
| 8022 | 9년 전 | 310 | ||
| 8021 | 9년 전 | 316 | ||
| 8020 | 9년 전 | 309 | ||
| 8019 | 9년 전 | 334 | ||
| 8018 | 9년 전 | 438 | ||
| 8017 | 9년 전 | 531 | ||
| 8016 | 9년 전 | 318 | ||
| 8015 | 9년 전 | 382 | ||
| 8014 | 9년 전 | 316 | ||
| 8013 | 9년 전 | 229 | ||
| 8012 | 9년 전 | 238 | ||
| 8011 | 9년 전 | 437 | ||
| 8010 | 9년 전 | 290 | ||
| 8009 | 9년 전 | 274 | ||
| 8008 | 9년 전 | 279 | ||
| 8007 | 9년 전 | 421 | ||
| 8006 | 9년 전 | 456 | ||
| 8005 |
|
9년 전 | 960 | |
| 8004 | 9년 전 | 344 | ||
| 8003 | 9년 전 | 413 | ||
| 8002 | 9년 전 | 319 | ||
| 8001 |
|
9년 전 | 662 | |
| 8000 | 9년 전 | 406 | ||
| 7999 | 9년 전 | 367 | ||
| 7998 | 9년 전 | 418 | ||
| 7997 | 9년 전 | 304 | ||
| 7996 | 9년 전 | 530 | ||
| 7995 | 9년 전 | 445 | ||
| 7994 | 9년 전 | 303 | ||
| 7993 | 9년 전 | 368 | ||
| 7992 | 9년 전 | 500 | ||
| 7991 | 9년 전 | 244 | ||
| 7990 | 9년 전 | 263 | ||
| 7989 | 9년 전 | 295 | ||
| 7988 | 9년 전 | 719 | ||
| 7987 | 9년 전 | 413 | ||
| 7986 | 9년 전 | 404 | ||
| 7985 | 9년 전 | 503 | ||
| 7984 | 9년 전 | 424 | ||
| 7983 | 9년 전 | 648 | ||
| 7982 | 9년 전 | 505 | ||
| 7981 | 9년 전 | 457 | ||
| 7980 | 9년 전 | 484 | ||
| 7979 | 9년 전 | 454 | ||
| 7978 | 9년 전 | 434 | ||
| 7977 | 9년 전 | 376 | ||
| 7976 | 9년 전 | 844 | ||
| 7975 | 9년 전 | 354 | ||
| 7974 | 9년 전 | 385 | ||
| 7973 | 9년 전 | 586 | ||
| 7972 | 9년 전 | 371 | ||
| 7971 | 9년 전 | 451 | ||
| 7970 | 9년 전 | 285 | ||
| 7969 | 9년 전 | 535 | ||
| 7968 | 9년 전 | 374 | ||
| 7967 | 9년 전 | 360 | ||
| 7966 | 9년 전 | 362 | ||
| 7965 |
|
9년 전 | 1007 | |
| 7964 | 9년 전 | 392 | ||
| 7963 | 9년 전 | 383 | ||
| 7962 | 9년 전 | 362 | ||
| 7961 |
전갈자리남자
|
9년 전 | 501 | |
| 7960 | 9년 전 | 955 | ||
| 7959 | 9년 전 | 546 | ||
| 7958 | 9년 전 | 400 | ||
| 7957 | 9년 전 | 360 | ||
| 7956 | 9년 전 | 365 | ||
| 7955 | 9년 전 | 438 | ||
| 7954 | 9년 전 | 365 | ||
| 7953 | 9년 전 | 419 | ||
| 7952 | 9년 전 | 345 | ||
| 7951 | 9년 전 | 493 | ||
| 7950 | 9년 전 | 381 | ||
| 7949 | 9년 전 | 381 | ||
| 7948 | 9년 전 | 320 | ||
| 7947 | 9년 전 | 925 | ||
| 7946 | 9년 전 | 416 | ||
| 7945 | 9년 전 | 385 | ||
| 7944 | 9년 전 | 400 | ||
| 7943 | 9년 전 | 363 | ||
| 7942 | 9년 전 | 400 | ||
| 7941 | 9년 전 | 381 | ||
| 7940 | 9년 전 | 871 | ||
| 7939 | 9년 전 | 340 | ||
| 7938 | 9년 전 | 371 | ||
| 7937 | 9년 전 | 271 | ||
| 7936 | 9년 전 | 875 | ||
| 7935 | 9년 전 | 433 | ||
| 7934 | 9년 전 | 400 | ||
| 7933 | 9년 전 | 495 | ||
| 7932 | 9년 전 | 459 | ||
| 7931 | 9년 전 | 515 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기