Send us pull requests and help improve the code.
The official API wrapper for Premium Media Script
The example below shows how to set it up. You need to get your API key from the settings page of the admin control panel
/**
* Include the main class
*/
include("API/Media.php");
$media = new kbrmedia\Media();
$media->setURL("http://media.site/api");
$media->setKey("APIKEY");
Get data for a single media by sending the unique ID of the media
/**
* View Endpoint
* Get data for one media
* @param string Unique Media ID
*/
$media->media("UNIQUEMEDIAID")->asObject();
Search media by sending filters & a keyword
/**
* Search Endpoint
* Get data for searched media
* @param integer Limits (optional)
* @param string Order: date, votes, views (optional)
* @param integer currentpage (optional)
* @param string keyword
*/
$media->setLimit("10")->setOrder("date")->setPage("1")->search("Keyword")->asObject();
Get user's uploads by sending filters & the user
/**
* User's upload
* @param integer Limits (optional)
* @param string Order: date, votes, views (optional)
* @param integer currentpage (optional)
* @param string username
*/
$media->setLimit("10")->setOrder("date")->setPage("1")->user("admin")->asObject();
If you wish to work with an array of data instead of object, use asArray.
/**
* View Endpoint as Array
* Get data for one media
* @param string Unique Media ID
*/
$media->media("UNIQUEMEDIAID")->asArray();
If you wish to work with a JSON instead of object, use asJSON.
/**
* View Endpoint as JSON
* Get data for one media
* @param string Unique Media ID
*/
$media->media("UNIQUEMEDIAID")->asJSON();