PHP code example of rafaelssucupira / telegram-api
1. Go to this page and download the library: Download rafaelssucupira/telegram-api library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rafaelssucupira / telegram-api example snippets
elegramAPI\Telegram;
$telegram = new Telegram(
"TOKEM"
);
//Enviar mensagem
$msg = $telegram->sendMessage(
"xxxxxxxxx",
"Hello World!"
);
//Receber ID do arquivo
$getFileProfile = $telegram->getFileID(
"xxxxxxxxx"
);
//Receber path do arquivo
$path = $telegram->getPath(
json_decode($getFileProfile, true)["result"]["photos"][0][0]["file_id"]
);
//Baixar arquivo
$telegram->downloadFile(
"profile.jpg",
$path
);