Upload self-signed ssl certificate to telegram

不羁的心 提交于 2019-12-03 15:20:02

问题


I'm making telegram bot using webhook on php. The problem is that the webhook doesn't set correctly and idk whats the matter. my setwebhook code :

$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";
}

回答1:


You can set the webhook via the terminal rather than in your code like so:

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



来源:https://stackoverflow.com/questions/33392278/upload-self-signed-ssl-certificate-to-telegram

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!