Link Search Menu Expand Document

Method: account.changePhone

Back to methods index

Change the phone number of the current account

Parameters:

NameTypeDescriptionRequired
phone_numberstringNew phone numberYes
phone_code_hashstringPhone code hash received when calling account.sendChangePhoneCodeYes
phone_codestringPhone code received when calling account.sendChangePhoneCodeYes

Return type: User

Can bots use this method: NO

MadelineProto Example (now async for huge speed and parallelism!):

if (!file_exists('madeline.php')) {
    copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}
include 'madeline.php';

$MadelineProto = new \danog\MadelineProto\API('session.madeline');
$MadelineProto->start();

// PHP 8+ syntax, use an array on PHP 7.
$User = $MadelineProto->account->changePhone(phone_number: 'string', phone_code_hash: 'string', phone_code: 'string', );