mardi 29 novembre 2016

How to send a request to the Telegram API?

I have read the documentation here http://ift.tt/1ctUT2G. I want to use api (not bot). I created an application and received api_id, app_hash, Test configuration (ip and port), Production configuration (ip and port) and Public keys. This is all metods http://ift.tt/1dopX0j. I want use metod auth.checkPhone. But I do not understand how to send a request.

Headers should be such as:

POST /apiw1 HTTP/1.1
Host: 000.000.000.000:443 //Production configuration
Connection: keep-alive
Content-Length: ...
Origin: ...
User-Agent: ...
Accept: */*
Referer: ...
Accept-Encoding: gzip, deflate
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4

But the data is encoded by MTProto.

From documentation written

auth.checkedPhone#e300cc3b phone_registered:Bool phone_invited:Bool = auth.CheckedPhone;
---functions---
auth.checkPhone#6fe51dfb phone_number:string = auth.CheckedPhone;

Please tell me step by step how to encode data from this metod "auth.checkPhone". And how to get the Authorization Key? I read the documentation, but I do not understand. Tell me the logic please, the code I will write itself on php.




Aucun commentaire:

Enregistrer un commentaire