3v4l.org

run code in 300+ PHP versions simultaneously
<?php require_once 'config.php'; require_once 'functions.php'; if($_GET['url']){ $track_url = $_GET['url']; $track_url = trim($track_url); } if(!$track_url){ header("Location: /?utm_source=noinput"); exit(); } if((!filter_var($track_url, FILTER_VALIDATE_URL)) && (!empty($track_url))){ $error="Invalid URL"; } if(!$error){ $url="http://api.soundcloud.com/resolve.json?url=".$track_url."&client_id=".$client_id; $response_code=check_url($url); if($response_code==404){ $error="Playlist not found"; } if($response_code==400){ $error="Bad URL (#400)"; } } if(!$error){ $headers1=get_headers($url,1); $location1=$headers1['Location']; if(!$location1){ $headers1=get_headers($url,1); $location1=$headers1['Location']; } } if($location1){ $json = file_get_contents_curl($location1) or error_log("download error for $url"); if(!$json){ $json = file_get_contents_curl($location1) or error_log("download error again for $url"); } if(!$json){ header("Location: /?error=1&utm_source=downloaderror"); exit(); } } else { $error="Unable to get playlist data"; } if(!$error){ $obj = json_decode($json, true); $kind=$obj['kind']; if($kind!='playlist'){ $error="Not a playlist!"; } } if(!$error){ $id=$obj['id']; $title=$obj['title']; $sclink=$obj['permalink_url']; $buy=$obj['purchase_url']; $user=$obj['user']; $user_id=$user['id']; $user=$user['username']; $duration=$obj['duration']; $description=$obj['description']; $tracks=$obj['tracks']; $pic=$obj['artwork_url']; $pic300=$pic; $pagetitle="$title - $user | $sitename"; $description="Download $title for free. Listen to $title or download $title. $title Mp3, audio music. Download music using SC-DOWNLOADER.COM fast, simple and free."; $metakeywords="$title, $user, $title by $user, $title Mp3, $title music, download $title, audio music, sc-downloader.com"; $description=str_replace('"', '\'', $description); $metakeywords=str_replace('"', '\'', $metakeywords); } else { $pagetitle="Error! | $sitename"; } $head_include_html=<<<EOF <meta itemprop="name" content="$title" /> <meta itemprop="description" content="$description" /> <meta itemprop="image" content="$pic300" /> <meta name="twitter:card" content="summary" /> <meta name="twitter:title" content="$title" /> <meta name="twitter:description" content="$description" /> <meta name="twitter:image:src" content="$pic300" /> <meta name="twitter:domain" content="sc-downloader.com" /> <meta property="og:title" content="$title" /> <meta property="og:type" content="music.song" /> <meta property="og:description" content="$description" /> <meta property="og:image" content="$pic300" /> <meta property="og:url" content="http://sc-downloader.com/playlist/$title-$id.html" /> <meta property="og:site_name" content="$sitename" /> <meta property="og:see_also" content="http://sc-downloader.com" /> <meta property="fb:admins" content="100001767032587" /> <link rel="canonical" href="http://sc-downloader.com/playlist/$title-$id.html" /> EOF; require_once("assets/header.php"); ?> <?php if($error){ echo "<h2>Error!</h2>"; echo "<p class='error'><b>Error!</b> ".$error."</p>"; } else { echo "<h2>$title <small> ($user) </small></h2>"; echo "<p>$description</p>"; if(!is_array($tracks)) { echo "<p class='error'>Unable to fetch playlist. Please try again!</p>"; } else { echo "<h2>Tracks</h2>"; foreach($tracks as $track){ $link=urlencode($track['permalink_url']); $html=<<<EOF <a href="/download.php?url=$link&amp;utm_source=playlist_downloader">Download $title</a> <br/> EOF; } } } ?> <?php require_once("assets/footer.php"); ?>

preferences:
38.92 ms | 402 KiB | 5 Q