Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SetWebHook on localhost in php

Tags:

php

ssl

I want to use SetWebHook telegram bot API in php

But for that, I should use HTTPS certificate
I don't have a certificate
My question is this :

can i use a self signed certificate in localhost and use setwebhook in telegram !?

Would you mind show me a piece of php code for setwebhook !?

for example i write the following code :

<?php
$client = new Zelenin\Telegram\Bot\Api('someRandomToken');
try {

    if($update->message->text != '/next_event_datetime')
        exit;
    $response = $client->sendMessage([
        'chat_id' => $update->message->chat->id,
        'text' => $dateTime
    ]);

} catch (\Zelenin\Telegram\Bot\NotOkException $e) {

    //echo $e->getMessage();

}

and my second question is :

Please explain to me how to set self signed certificate in Wamp

There are many tutorials about that in the internet. but they never worked.
because all of them are old.
Can anybody here that show to me how do i can use Self signed in Wamp !?

and could i use SetWebHook with a self signed certificate in localhost !?

Thanks...

like image 391
Alireza378n A Avatar asked Dec 14 '25 08:12

Alireza378n A


1 Answers

I think you can not set webhook on localhost! you can use self signed certificate (on host) and you should upload it when you want to set webhook. here is more information https://core.telegram.org/bots/self-signed

like image 77
Moonlight Avatar answered Dec 16 '25 23:12

Moonlight



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!