Skip to content

Instantly share code, notes, and snippets.

View salvatorecordiano's full-sized avatar
🚀
People are everything

Salvatore Cordiano salvatorecordiano

🚀
People are everything
View GitHub Profile
@salvatorecordiano
salvatorecordiano / webhook.php
Last active March 10, 2023 10:27
Sample Telegram Bot (3)
<?php
// recupero il contenuto inviato da Telegram
$content = \file_get_contents('php://input');
// converto il contenuto da JSON ad array PHP
$update = \json_decode($content, true);
// se la richiesta è null interrompo lo script
if(!$update) {
exit;
}
// assegno alle seguenti variabili il contenuto ricevuto da Telegram
@salvatorecordiano
salvatorecordiano / webhook.php
Last active February 28, 2023 18:18
Sample Telegram Bot (1)
<?php
$content = file_get_contents("php://input");
$update = json_decode($content, true);
if(!$update)
{
exit;
}
$message = isset($update['message']) ? $update['message'] : "";
<?php
$chatId = '---YOUR USER ID---';
$request = [
'chat_id' => $chatId,
'text' => 'Fai tap su condividi numero telefonico',
'reply_markup' => [
'keyboard' => [
[
@salvatorecordiano
salvatorecordiano / webhook.php
Last active May 5, 2020 13:07
Sample Telegram Bot (2)
<?php
$content = file_get_contents("php://input");
$update = json_decode($content, true);
if(!$update)
{
exit;
}
$message = isset($update['message']) ? $update['message'] : "";
<?php
// recupero il contenuto inviato da Telegram
$content = file_get_contents("php://input");
// converto il contenuto da JSON ad array PHP
$update = json_decode($content, true);
// se la richiesta è null interrompo lo script
if(!$update)
{
exit;
}
<?php
// recupero il contenuto inviato da Telegram
$content = file_get_contents("php://input");
// converto il contenuto da JSON ad array PHP
$update = json_decode($content, true);
// se la richiesta è null interrompo lo script
if(!$update)
{
exit;
}
@salvatorecordiano
salvatorecordiano / webhook.php
Last active April 7, 2020 19:43
Sample Telegram Bot (4)
<?php
// insert here your Bot API token
define("BOT_TOKEN", "...");
$content = file_get_contents("php://input");
$update = json_decode($content, true);
if(!$update)
{
exit;
}
$message = isset($update['message']) ? $update['message'] : "";
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
# first way
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
<?php
header('Content-Type: application/json');
$content = file_get_contents('php://input');
$update = json_decode($content, true);
if (!$update) {
exit;
}
$chatId = $update['message']['chat']['id'] ?? null;