Esempio n. 1
0
<?php

include_once "services.php";
$page = !empty($_GET["page"]) ? $_GET["page"] : "";
$reddit = new Reddit();
$soundcloud = new SoundCloud();
$youtube = new Youtube();
// $beatport = new Beatport();
$S = new Services();
if ($page == "filters") {
    foreach ($S::getServices() as $k => $v) {
        echo "<input type=\"checkbox\" name=\"tracks-services\" value=\"{$k}\" id=\"{$k}\" /><label for=\"{$k}\">{$k}</label><br />";
    }
    echo <<<EOT
<script type="text/javascript">
\$("#filters-tracks").siblings().hide().end().show().find("input").button({ icons: { primary: "ui-icon-check" } }).click(function(){
\tif( this.checked ) {
\t\t\$(this).button("option", "icons", { primary: "ui-icon-close" });
\t\t\$("#loadhere").children("#tracks").find(".item."+\$(this).val().toLowerCase()).hide();
\t}
\telse {
\t\t\$(this).button("option", "icons", { primary: "ui-icon-check" });
\t\t\$("#loadhere").children("#tracks").find(".item."+\$(this).val().toLowerCase()).show();
\t}
});
</script>
EOT;
} else {
    if ($page == "search") {
        header("Content-type: application/json");
        $q = urldecode($_GET["q"]);
<?php

$stream_url = false;
if (array_key_exists('soundcloud-url', $_POST)) {
    $url = $_POST['soundcloud-url'];
    $stream_data = SoundCloud::getStreamData($url);
    $mp3_data = SoundCloud::getMusic($stream_data["stream_url"]);
    $filename = $stream_data["stream_title"] . ".mp3";
    header("Content-Type: audio/mpeg");
    header("Content-Disposition: attachment; filename={$filename}");
    return $mp3_data;
} else {
    return "There has been an error, please try again.";
}
Esempio n. 3
0
<?php

require 'SoundCloud.php';
$soundcloud = new SoundCloud(['client_id' => 'fab1869f594107d250ff7afcd029dfc4']);
$json = $soundcloud->getUsers('users/iammcjin/tracks.json');
echo $json;