簡體   English   中英

如何將文件從服務器發送到電報機器人php

[英]how to send file from server to telegram bot php

我想將APK文件從服務器(URL)發送到電報機器人

<?php 
    if ($update->callback_query->data == "app_dl"){
        $chat_id = $update->callback_query->message->chat->id;
        $document = "BQADBAAD2wADHg4hUfbD3f-YYGc3Ag";
        $caption = "text";
        var_dump(
            makeHTTPRequest('sendDocument',[
                'chat_id'=>$chat_id,
                'document'=> $document,
                'caption'=> $caption
            ])
        );  
    }
?>

我嘗試了此操作,並從電報服務器向機器人發送了一個APK文件,但我想從服務器發送一個APK文件進行啟動

如果啟用了cURL請在此處檢查 ),則可以嘗試以下操作:

$filePath = 'myfile.apk'; // Relative path to a file in current directory
$document = new CURLFile(realpath($filePath));

對我來說很完美,但是您也可以在這里查看是否不適合您。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM