简体   繁体   English

将自签名的SSL证书上传到电报

[英]Upload self-signed ssl certificate to telegram

I'm making telegram bot using webhook on php. 我在php上使用webhook制作电报机器人。 The problem is that the webhook doesn't set correctly and idk whats the matter. 问题是webhook设置不正确,idk出了什么问题。 my setwebhook code : 我的setwebhook代码:

$ch = curl_init(API_URL);
try {
    $cert = new \CURLFile(SSL_KEY);
apiRequest('setWebhook', array('url' =>  WEBHOOK_URL , 'certificate' => $cert));
    echo "webhook set";
} catch (Exception $e) {
    echo "error";
}

You can set the webhook via the terminal rather than in your code like so: 您可以通过终端而不是在代码中设置webhook,如下所示:

curl -F "url=https://your_domain.com/where-the-script-will-be/bot-script.php" -F "certificate=@/location/of/cert/certificate.crt" https://api.telegram.org/bot000000000:AAAAa0aAA_aaA-Aaaa0A0Aa_a0aa0A0AAAA/setWebhook

This has worked for my own projects without any issues 这已经为我自己的项目工作,没有任何问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM