File tree Expand file tree Collapse file tree 1 file changed +4
-16
lines changed
Expand file tree Collapse file tree 1 file changed +4
-16
lines changed Original file line number Diff line number Diff line change @@ -372,25 +372,13 @@ public function getMessageObject($msgid) {
372372 }
373373
374374 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 {
375+ $ response = $ this ->getMessageObject ($ msgid );
376+ if ($ response != null ) {
391377 $ file = fopen ($ path .$ msgid , "wb " );
392378 fwrite ($ file , $ response );
393379 fclose ($ file );
380+ }else {
381+ return false ;
394382 }
395383 }
396384
You can’t perform that action at this time.
0 commit comments