PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Lukas Bonsch   PHP Mixcloud Player   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example
Class: PHP Mixcloud Player
Embed player of music hosted in Mixcloud
Author: By
Last change: Changed to version 2.0
Date: 2 years ago
Size: 2,157 bytes
 

Contents

Class file image Download
<?php
require_once("class_mixcloud_player.php");

//using the mixcloud api reference user spartacus
//also see https://www.mixcloud.com/developers/ and https://www.mixcloud.com/spartacus/
$mixcloud = new mixcloud_player("spartacus");

echo
"show Userdata:";
echo
$mixcloud->getUser_HTML();
echo
"<br>-------------------------<br>";
echo
"show the latest upload (get's the embed code via api)";

echo
$mixcloud->get_latest_player();
echo
"-------------------------<br>";
echo
"for the latest upload there is also the to string option:";
echo
$mixcloud;
echo
"-------------------------<br>";
echo
"get specific upload via offset (this returns the third latest upload)";
echo
$mixcloud->get_player(3);
echo
"-------------------------<br>";
echo
"GET ALL THE UPLOADS";
$i = 1;
while(
$i < $mixcloud->get_count())
{
    echo
$mixcloud->get_player($i);
   
$i++;
}

echo
"-------------------------<br>";
echo
"DARK MODE";
$mixcloud_dark = new mixcloud_player("spartacus");
$mixcloud_dark->setPlayerstyle(true);
echo
$mixcloud_dark->get_latest_player();

echo
"-------------------------<br>";
echo
"HIDE COVER / different height";
$mixcloud_other = new mixcloud_player("spartacus");
$mixcloud_other->setPlayerstyle(true, false);
echo
$mixcloud_other->get_latest_player("100%", "400px");
echo
"-------------------------<br>";
echo
"specific show from user by title";
$mixcloud_show = new mixcloud_player("spartacus");
echo
$mixcloud_show->getShow("Party Time");
echo
"-------------------------<br>";
echo
"playlist example with playlist title";
//using the mixcloud api reference user spartacus
//using the playlist "Save for a rainy day"
//also see https://www.mixcloud.com/developers/ and https://www.mixcloud.com/spartacus/playlists/save-for-a-rainy-day/

$mixcloudpl = new mixcloud_player("spartacus");
$mixcloudpl->setPlaylist("Save for a rainy day");


echo
$mixcloudpl->get_latest_player();
echo
"-------------------------<br>";
//for the latest upload there is also the to string option:
echo $mixcloudpl;
echo
"-------------------------<br>";
//get specific upload via offset (this returns the third latest upload)
echo $mixcloudpl->get_player(3);

?>