skip to Main Content

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


  1. Use one of these functions :

    include("PATHTOTHEFILE/FILE.PHP"); 
    include_once("PATHTOTHEFILE/FILE.PHP");
    require("PATHTOTHEFILE/FILE.PHP"); 
    require_once("PATHTOTHEFILE/FILE.PHP");
    

    to include your class, or your code won’t find it and will bug if you try to instantiate it.

    Login or Signup to reply.
  2. You must first run composer update in the MadelineProto repo, and then require it using

    require 'vendor/autoload.php';

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search