I try to learn MadelineProto for make a my telegram userBot.
When I make the instance of the API class, I get this Error:
PHP Fatal error: Uncaught Error: Class ‘API’ not found in /var/www/html/projects/quotidiano/MadelineProto/src/danog/MadelineProto/test.php:3
The code is this:
$MadelineProto = new API();
$inputFile = $MadelineProto->upload('pippo.txt', 'pluto.txt');
// Generate an inputMedia object and store it in $inputMedia, see tests/testing.php
$MadelineProto->messages->sendMedia(['peer' => 'xxxxxx', 'media' => $inputMedia]);
$inputEncryptedFile = $MadelineProto->upload_encrypted('pippo.txt', 'pippo.txt');
2
Answers
Use one of these functions :
to include your class, or your code won’t find it and will bug if you try to instantiate it.
You must first run
composer update
in the MadelineProto repo, and then require it usingrequire 'vendor/autoload.php';