README.md

codesamples-php-codeExampleBot

php 7.2 curl Telegram API NASAAPI to Telegram

Description

In fact a gateway between the NASA API and Telegram API - if you run the bot it will get the information about closet asteroids to Earth for today and then choose on random asteroid from a returned list and send it to Telegram API to the bot, for which you would provide token and chat id(should be received from Telegram API and populated to the bot configuration ini file in config folder)

Purposes

To demonstrate ability to work with various APIs and implement cross-API interaction

Requirements

  1. PHP 7.2
  2. CURL extension for PHP 7.2
  3. Telegram bot created via botFather(see here: https://core.telegram.org/api)

    Installation instructions (approximate, not the last ones to follow):

  4. git clone this project
  5. [optional] sudo apt-get install php7.2-cli
  6. [optional] sudo add-apt-repository ppa:ondrej/php
  7. [optional] sudo apt-get install php7.2-curl
  8. Open your telegram app
  9. Search for @botfather - simply put @botfather to search widget
  10. You will see BotFather and ‘I can help you create and m…’ below
  11. Click on it and press start
  12. Command @BotFather a /newbot
  13. You will receive ‘Alright, a new bot. How are we going to call it? Please choose a name for your bot.’
  14. Answer with the name of your bot
  15. The system asks for the user name of your bot
  16. Answer with something that ends with _bot
  17. You will receive token
  18. [as per https://core.telegram.org/bots/api , follow to Making Requests header] Follow https://api.telegram.org/bot/getUpdates (instead of you token value)
  19. Send something to your bot and refresh the page mentioned at point 15 - you should get you chat id - token and chat_id to the /config/codeExampleBot_config.ini instead of placeholder message after =
  20. Additional information via https://blog.meer-web.nl/sending-telegram-messages-using-php/

How to run?:

  1. php /path/to/codeExampleBot.php
  2. Check you Telegram for message
Описание

Portfolio demo app API requests

Конвейеры
0 успешных
0 с ошибкой