|
28 | 28 | Third Party Update by SuperSonic |
29 | 29 | ==================================== |
30 | 30 | Copyright(c) 2018 Randy Chen. http://randychen.tk/ |
31 | | - Version: 2.1 |
| 31 | + Version: 2.2 |
32 | 32 | More Information: |
33 | 33 | https://github.com/supersonictw/line-bot-sdk-php-tiny |
34 | 34 | */ |
@@ -350,6 +350,50 @@ public function multicast($to, $message) { |
350 | 350 | } |
351 | 351 | } |
352 | 352 |
|
| 353 | + public function getMessageObject($msgid) { |
| 354 | + $header = array( |
| 355 | + 'Authorization: Bearer ' . $this->channelAccessToken, |
| 356 | + ); |
| 357 | + |
| 358 | + $context = stream_context_create(array( |
| 359 | + "http" => array( |
| 360 | + "method" => "GET", |
| 361 | + "header" => implode("\r\n", $header), |
| 362 | + ), |
| 363 | + )); |
| 364 | + |
| 365 | + $response = file_get_contents($this->host."/v2/bot/message/".$msgid."/content", false, $context); |
| 366 | + if (strpos($http_response_header[0], '200') === false) { |
| 367 | + http_response_code(500); |
| 368 | + error_log("Request failed: " . $response); |
| 369 | + }else { |
| 370 | + return $response; |
| 371 | + } |
| 372 | + } |
| 373 | + |
| 374 | + public function downloadMessageObject($msgid, $path = "./") { |
| 375 | + $header = array( |
| 376 | + 'Authorization: Bearer ' . $this->channelAccessToken, |
| 377 | + ); |
| 378 | + |
| 379 | + $context = stream_context_create(array( |
| 380 | + "http" => array( |
| 381 | + "method" => "GET", |
| 382 | + "header" => implode("\r\n", $header), |
| 383 | + ), |
| 384 | + )); |
| 385 | + |
| 386 | + $response = file_get_contents($this->host."/v2/bot/message/".$msgid."/content", false, $context); |
| 387 | + if (strpos($http_response_header[0], '200') === false) { |
| 388 | + http_response_code(500); |
| 389 | + error_log("Request failed: " . $response); |
| 390 | + }else { |
| 391 | + $file = fopen($path.$msgid, "wb"); |
| 392 | + fwrite($file, $response); |
| 393 | + fclose($file); |
| 394 | + } |
| 395 | + } |
| 396 | + |
353 | 397 | private function sign($body) { |
354 | 398 | $hash = hash_hmac('sha256', $body, $this->channelSecret, true); |
355 | 399 | $signature = base64_encode($hash); |
@@ -447,4 +491,15 @@ public function Flex($url, $contents = null) { |
447 | 491 | } |
448 | 492 | } |
449 | 493 |
|
| 494 | +class LINEMSG_Imagemap { |
| 495 | + |
| 496 | +} |
| 497 | + |
| 498 | +class LINEMSG_Template { |
| 499 | + |
| 500 | +} |
| 501 | + |
| 502 | +class LINEMSG_FlexContainer { |
| 503 | + |
| 504 | +} |
450 | 505 | ?> |
0 commit comments