在一个基于PHP的网站以电报的聊天:HOWTO? [英] Telegram-based chat on a PHP-based site: HOWTO?

查看:302
本文介绍了在一个基于PHP的网站以电报的聊天:HOWTO?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法弄清楚究竟到我的网站和电报服务之间使用的交互(首先 - 如何获得使用PHP和其他的东西像用户之间的聊天完成认证过程)。

在本页面: https://core.telegram.org/api 我没有一个想法如何使用这些函数在PHP。

根据这一页: https://telegram.org/apps
我有两个选择:

1)CLI界面(非官方的,顺便说一句): https://github.com/vysheng/ TG
和它不具有除其他一个autentification功能。为了验证自己,你需要运行:

 斌/电报CLI -k tg-server.pub

,你必须输入你的手机,并通过短信发送的秘密code中的应用程序内部的 - 你的授权之后。然后安装 https://github.com/zyberspace/php-telegram-cli-client 和运行的电报CLI 作为一个守护进程:

  ./斌/电报CLI -dWS /tmp/tg.sck -k tg-server.pub&安培;

这是否意味着我必须手动创建tg-server.pub使用PHP为其尝试登录每个用户?

2)Webogram: https://github.com/zhukov/webogram - 但它写在JavaScript和具有非常复杂的code。

尊敬的大师#1,也许你更周到的比我并能帮助我认识到正确的解决方案(或示例,我不知道,PHP代码片段或其他任何东西)的基础上的电报,为用户的聊天和PHP?

我将不胜AP preciate呢!

感谢您!


解决方案

我已经贴了一步一步的指导上让你的AUTHKEY(VB.net)的

用电报API的主要挑战是文档...但如果​​你能够通过第一部分的工作 - 获得一个AUTHKEY那么相信剩下的应该落在地方......一些更多的精力

工作的一些GitHub上的src 的可能是耗时的,它可能是最好得到的文档的句柄,然后你的工作方式从头

I can't figure out what exactly to use for interaction between my site and the Telegram service (first of all - how to get the authentication process done using PHP and other stuff like chat among users).

On this page: https://core.telegram.org/api I haven't got an idea how to use those functions in PHP.

According to this page: https://telegram.org/apps I have two choices:

1) The CLI-interface (unofficial, by the way): https://github.com/vysheng/tg and it doesn't have an autentification function among others. In order to authenticate yourself, you need to run:

bin/telegram-cli -k tg-server.pub 

and inside of the application you have to enter your cell phone and the secret code sent by SMS - after that you're authorized. Then you install https://github.com/zyberspace/php-telegram-cli-client and run telegram-cli as a daemon:

./bin/telegram-cli -dWS /tmp/tg.sck -k tg-server.pub &  

Does it mean that I have to create tg-server.pub manually using PHP for each user which is trying to login?

2) Webogram: https://github.com/zhukov/webogram - but it's written on JavaScript and has very complicated code.

Dear Stackoverflow gurus, maybe you're more attentive than I am and could help me to recognize the right solution (or example, I don't know, the PHP snippet or anything else) for the user's chat based on the Telegram and PHP?

I would greatly appreciate it!

Thank you!

解决方案

I have posted a step by step guide on getting your AuthKey (VB.net) here

The main challenge with Telegram API is the documentation... but if you can work through the first part - getting an AuthKey then i believe the rest should fall in place ... with some more effort.

Working through some GitHub src might be time consuming, it might be best to get a handle on the documentation and then work your way to building your own code for TelegramAPI from scratch

这篇关于在一个基于PHP的网站以电报的聊天:HOWTO?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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