如何在 Windows 7 和 PHP 上使用带有自证书的 Telegram 中的 setWebhook? [英] How to use setWebhook in Telegram with self certificates on Windows 7 and PHP?

查看:44
本文介绍了如何在 Windows 7 和 PHP 上使用带有自证书的 Telegram 中的 setWebhook?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Telegram 的新手,我正在尝试用它迈出我的第一步.

I'm quite a newbye in Telegram and I'm trying moving my first steps with it.

我在这里找到了一个很好的教程 https://www.youtube.com/watch?v=hJBYojK7DO4:我已经使用 PHP 和 SSL 配置了我的 Apache 2.4,并且一切正常,教程中的示例也是如此.

I've found a good tutorial here https://www.youtube.com/watch?v=hJBYojK7DO4: I've configured my Apache 2.4 with PHP and SSL and all works fine, also the samples in the tutorial.

问题是使用 setWebhook 方法......当我尝试放入浏览器时

Troubles are using the setWebhook method .... when I try to put in my browser

https://api.telegram.org/<my_bot_code>/setWebHook?url=https://localhost/Telegram/MyYouTubeTutorialBot/YouTubeTutorialBot.php

响应是

{"ok":false,"error_code":400,"description":"Error: Bad webhook: Error: Ip is reserved"}

请注意,我使用的是自生成的证书....

Note that I'm using a self generated certificate ....

我在 api Telegram 文档中找到了(参考.https://core.telegram.org/bots/faq#i-39m-have-problems-with-webhooks),那

I've found in the api Telegram documentation (ref. https://core.telegram.org/bots/faq#i-39m-having-problems-with-webhooks), that

"..... 要使用自签名证书,您需要使用 setWebhook 中的 certificate 参数上传您的公钥证书.请上传为 InputFile,发送字符串将不起作用."

我不明白如何上传我的公钥证书文件......有什么例子吗?

I don't understand how to upload my public key certificate file .... any examples somewhere?

问题可能是因为我使用 localhost 和默认 IP 地址 127.0.0.1我当地的阿帕奇?我是否应该使用每次连接到网络时都会更改的当前 IP 地址来更改我的 IP 地址(我正在使用 Internet 密钥将我连接到网络.....)?

The problem could be because I'm using localhost and the default IP address 127.0.0.1 for my local Apache? Should I change my IP address using the current one that change every time I connect to the web (I'm using a internet key to connect me to the web .....)?

非常感谢您提前

推荐答案

使用以下简单的html代码

use following simple html code

<html>
<body>

<form action="https://api.telegram.org/bot<BOT_TOCKEN>/setwebhook" method="post" enctype="multipart/form-data">
    Select Certificate to upload:
    <input type="file" name="certificate" id="fileToUpload">
	URL: <input type="text" name="url"  value="https://<YOURWEBSITE>/<YOUR_PHP_URL>"><br>
    <input type="submit" value="Upload Certificate" name="submit">
</form>

</body>
</html>

这篇关于如何在 Windows 7 和 PHP 上使用带有自证书的 Telegram 中的 setWebhook?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆