[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개
이런사람입니다. ^^
미투 !!
잘될거에요!
봇생성만 조금 어렵지 그다음은 쉬우니....
좋은자료 감사합니다 .!!
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 430 | 19년 전 | 4102 | ||
| 429 | 19년 전 | 3305 | ||
| 428 | 19년 전 | 4132 | ||
| 427 | 19년 전 | 3474 | ||
| 426 | 19년 전 | 3106 | ||
| 425 | 19년 전 | 3408 | ||
| 424 | 19년 전 | 2438 | ||
| 423 | 19년 전 | 2866 | ||
| 422 | 19년 전 | 2353 | ||
| 421 | 19년 전 | 3708 | ||
| 420 | 19년 전 | 4743 | ||
| 419 | 19년 전 | 3802 | ||
| 418 |
|
19년 전 | 1750 | |
| 417 | 19년 전 | 2749 | ||
| 416 | 19년 전 | 2392 | ||
| 415 | 19년 전 | 2607 | ||
| 414 | 19년 전 | 4411 | ||
| 413 |
|
19년 전 | 2601 | |
| 412 | 19년 전 | 3047 | ||
| 411 |
|
19년 전 | 2996 | |
| 410 |
|
19년 전 | 3687 | |
| 409 |
|
19년 전 | 3636 | |
| 408 |
|
19년 전 | 1860 | |
| 407 | 19년 전 | 2230 | ||
| 406 | 19년 전 | 2783 | ||
| 405 | 19년 전 | 2452 | ||
| 404 | 19년 전 | 4304 | ||
| 403 | 19년 전 | 3305 | ||
| 402 |
NeoGenesis
|
19년 전 | 4091 | |
| 401 | 19년 전 | 2610 | ||
| 400 |
|
19년 전 | 2499 | |
| 399 | 19년 전 | 2957 | ||
| 398 | 19년 전 | 2488 | ||
| 397 | 19년 전 | 2780 | ||
| 396 | 19년 전 | 2479 | ||
| 395 | 19년 전 | 3186 | ||
| 394 | 19년 전 | 1723 | ||
| 393 | 19년 전 | 2994 | ||
| 392 | 19년 전 | 2256 | ||
| 391 | 19년 전 | 2177 | ||
| 390 | 19년 전 | 2287 | ||
| 389 | 19년 전 | 2646 | ||
| 388 | 19년 전 | 2180 | ||
| 387 | 19년 전 | 4485 | ||
| 386 |
|
19년 전 | 2693 | |
| 385 |
|
19년 전 | 2483 | |
| 384 | 19년 전 | 3019 | ||
| 383 | 19년 전 | 3056 | ||
| 382 | 19년 전 | 3109 | ||
| 381 |
|
19년 전 | 2631 | |
| 380 |
|
19년 전 | 3020 | |
| 379 | 19년 전 | 2550 | ||
| 378 | 19년 전 | 2208 | ||
| 377 | 19년 전 | 2779 | ||
| 376 | 19년 전 | 2470 | ||
| 375 |
|
19년 전 | 2564 | |
| 374 | 19년 전 | 3821 | ||
| 373 | 19년 전 | 3270 | ||
| 372 | 19년 전 | 4989 | ||
| 371 |
세은아빠2
|
19년 전 | 2415 | |
| 370 | 19년 전 | 4501 | ||
| 369 | 19년 전 | 3109 | ||
| 368 | 19년 전 | 2907 | ||
| 367 | 19년 전 | 3726 | ||
| 366 | 19년 전 | 2656 | ||
| 365 | 19년 전 | 3738 | ||
| 364 | 19년 전 | 4015 | ||
| 363 | 19년 전 | 3442 | ||
| 362 | 19년 전 | 3483 | ||
| 361 | 19년 전 | 4108 | ||
| 360 |
hwatta
|
19년 전 | 2365 | |
| 359 | 19년 전 | 5108 | ||
| 358 | 19년 전 | 3656 | ||
| 357 | 19년 전 | 2601 | ||
| 356 |
sdesign1s
|
19년 전 | 2279 | |
| 355 | 20년 전 | 2757 | ||
| 354 | 20년 전 | 3030 | ||
| 353 | 20년 전 | 2794 | ||
| 352 |
|
20년 전 | 5776 | |
| 351 |
|
20년 전 | 2705 | |
| 350 |
|
20년 전 | 4293 | |
| 349 |
hwatta
|
20년 전 | 2182 | |
| 348 | 20년 전 | 7307 | ||
| 347 | 20년 전 | 2414 | ||
| 346 | 20년 전 | 3505 | ||
| 345 | 20년 전 | 4311 | ||
| 344 | 20년 전 | 2651 | ||
| 343 | 20년 전 | 3922 | ||
| 342 | 20년 전 | 3069 | ||
| 341 | 20년 전 | 4093 | ||
| 340 |
|
20년 전 | 5143 | |
| 339 |
|
20년 전 | 4236 | |
| 338 | 20년 전 | 5869 | ||
| 337 | 20년 전 | 2045 | ||
| 336 |
|
20년 전 | 3325 | |
| 335 |
|
20년 전 | 3539 | |
| 334 |
|
20년 전 | 2930 | |
| 333 |
hwatta
|
20년 전 | 2437 | |
| 332 | 20년 전 | 4656 | ||
| 331 | 20년 전 | 2274 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기