<?php | |
$chatId = '---YOUR USER ID---'; | |
$request = [ | |
'chat_id' => $chatId, | |
'text' => 'Fai tap su condividi numero telefonico', | |
'reply_markup' => [ | |
'keyboard' => [ | |
[ | |
[ | |
'text' => 'Condividi numero telefonico', | |
'request_contact' => true | |
] | |
] | |
], | |
'one_time_keyboard' => true, | |
'resize_keyboard' => true | |
] | |
]; | |
apiRequest('---INSERT API TOKEN HERE---', $request); | |
function apiRequest(string $apiToken, array $request): array | |
{ | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, sprintf('https://api.telegram.org/bot%s/sendMessage', $apiToken)); | |
curl_setopt($ch, CURLOPT_POST, true); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-type: application/json']); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($request)); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
$content = curl_exec($ch); | |
curl_close($ch); | |
if(!$content) { | |
return []; | |
} | |
return json_decode($content, true); | |
} |
This comment has been minimized.
This comment has been minimized.
Ciao, non sono per nulla nerd ma per un problema di update del mio iPhone mi ritrovo ad aver perso una conversazione Telegram e soprattutto il numero della persona.. l’iphone Mi ha salvato solo il suo ID... posso recuperare il suo numero con il |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Ho provato ad implementare un bot che richieda il numero di telefono e lo inoltri direttamente in un'altra chat (in alternativa sarebbe utile salvarlo in un file di testo, ma non ci sono riuscito). Qual è il problema? Purtroppo conosco C e un po' di Java, ma non sono molto pratico con php...