Basic usage¶
Authenticate¶
First, please refer to the Authentication token section to retrieve your Real-Debrid API token.
Then, to authenticate, you just have to create a Token
<?php
use \RealDebrid\Auth\Token;
$token = new Token('MY_TOKEN');
Creating a client¶
Now, you have to create the RealDebrid client, which will be used to launch every call requests.
<?php
use \RealDebrid\RealDebrid;
$realDebrid = new RealDebrid($token);
Using the API¶
Here is some examples on how to use the Real-Debrid API. If you want more information about the available requests, please refer to the Available requests section.
<?php
// Retrieve user information
$userInformation = $realDebrid->user->get();
// Unrestrict a link
$link = $realDebrid->unrestrict->link('http://MY_LINK');
// Add a magnet link and start the torrent
$torrent = $realDebrid->torrents->addMagnet('magnet:MY_MAGNET_LINK');
$realDebrid->torrents->selectFiles($torrent->id);
// Retrieve torrents list
$torrentQueue = $realDebrid->torrents->get();