Upload self-signed ssl certificate to telegram

I am making a telegram bomb using webhook in php. The problem is that the webhook is not configured correctly and idk, what’s 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"; } 
+2
php ssl telegram telegram-bot
source share
1 answer

You can install webhook through the terminal, and not in your code:

 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 worked for my own projects without any problems.

+4
source share

All Articles