如何从电报消息中删除帐户代码

How to get delete account code from telegram msg

我需要使用 php

从这条消息中获取代码

并且用户名根据用户更改

Web login code. Dear username, we received a request from your account to log in on my.telegram.org. This is your login code:
nJB2G5Yb8Rs

Do not give this code to anyone, even if they say they're from Telegram! This code can be used to delete your Telegram account. We never ask to send it anywhere.

If you didn't request this code by trying to log in on my.telegram.org, simply ignore this message.


<?php


$text = "Web login code. Dear username, we received a request from your account to log in on my.telegram.org. This is your login code: nJB2G5Yb8Rs

Do not give this code to anyone, even if they say they're from Telegram! This code can be used to delete your Telegram account. We never ask to send it anywhere.

If you didn't request this code by trying to log in on my.telegram.org, simply ignore this message.";

preg_match('~Dear ([^,]+),.* login code: (\S+)\s~isU', $text, $output);

list($dummy, $username, $loginCode) = $output;

echo 'Username: '.$username.' Login Code: '.$loginCode;

?>