@ 2014-01-23T11:06:24Z <?php
require_once 'Services/Soundcloud.php';
/*
* function to get via cUrl
* From lastRSS 0.9.1 by Vojtech Semecky, webmaster @ webdot . cz
* See http://lastrss.webdot.cz/
*/
function curlGet($URL) {
$ch = curl_init();
$timeout = 3;
curl_setopt( $ch , CURLOPT_URL , $URL );
curl_setopt( $ch , CURLOPT_RETURNTRANSFER , 1 );
curl_setopt( $ch , CURLOPT_CONNECTTIMEOUT , $timeout );
/* if you want to force to ipv6, uncomment the following line */
//curl_setopt( $ch , CURLOPT_IPRESOLVE , 'CURLOPT_IPRESOLVE_V6');
$tmp = curl_exec( $ch );
curl_close( $ch );
return $tmp;
}
/*
* function to use cUrl to get the headers of the file
*/
function get_location($url) {
$my_ch = curl_init();
curl_setopt($my_ch, CURLOPT_URL,$url);
curl_setopt($my_ch, CURLOPT_HEADER, true);
curl_setopt($my_ch, CURLOPT_NOBODY, true);
curl_setopt($my_ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($my_ch, CURLOPT_TIMEOUT, 10);
$r = curl_exec($my_ch);
foreach(explode("\n", $r) as $header) {
if(strpos($header, 'Location: ') === 0) {
return trim(substr($header,10));
}
}
return '';
}
function get_size($url) {
$my_ch = curl_init();
curl_setopt($my_ch, CURLOPT_URL,$url);
curl_setopt($my_ch, CURLOPT_HEADER, true);
curl_setopt($my_ch, CURLOPT_NOBODY, true);
curl_setopt($my_ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($my_ch, CURLOPT_TIMEOUT, 10);
$r = curl_exec($my_ch);
foreach(explode("\n", $r) as $header) {
if(strpos($header, 'Content-Length:') === 0) {
return trim(substr($header,16));
}
}
return '';
}
function get_description($url) {
$fullpage = curlGet($url);
$dom = new DOMDocument();
@$dom->loadHTML($fullpage);
$xpath = new DOMXPath($dom);
$tags = $xpath->query('//div[@class="info-description-body"]');
foreach ($tags as $tag) {
$my_description .= (trim($tag->nodeValue));
}
return utf8_decode($my_description);
}
// create a client object with your app credentials
$client = new Services_Soundcloud(
'6813c5d125013568ef986b73e4ba265c', '2eb6f212de6f4963c3873f8afdf517e9');
// a permalink to a track
$track_url = 'http://soundcloud.com/forss/voca-nomen-tuum';
if($_GET['url']){
$track_url = $_GET['url'];
}
$url='http://api.soundcloud.com/resolve.json?url='.$track_url.'&client_id=6813c5d125013568ef986b73e4ba265c';
$headers=get_headers($url,1);
$location=$headers['Location'];
// resolve track URL into track resource
//$track = json_decode($client->get('resolve', array('url' => $track_url)));
/* now that we have the track id, we can get a list of comments, for example
foreach (json_decode($client->get('tracks/' . $track->id . 'comments')) as $c)
print 'Someone said: ' . $c->body . ' at ' . $c->timestamp . "\n";
try {
$track = $soundcloud->download($track->id);
} catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
exit($e->getMessage());
}
file_put_contents("files/download.mp3",$track);
echo "<a href='files/download.mp3'>download</a>";*/
echo $location;
function modify_url($mod, $url = FALSE){
// If $url wasn't passed in, use the current url
if($url == FALSE){
$scheme = $_SERVER['SERVER_PORT'] == 80 ? 'http' : 'https';
$url = $scheme.'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
}
// Parse the url into pieces
$url_array = parse_url($url);
// The original URL had a query string, modify it.
if(!empty($url_array['query'])){
parse_str($url_array['query'], $query_array);
foreach ($mod as $key => $value) {
if(!empty($query_array[$key])){
$query_array[$key] = $value;
}
}
}
// The original URL didn't have a query string, add it.
else{
$query_array = $mod;
}
return $url_array['scheme'].'://'.$url_array['host'].'/'.$url_array['path'].'?'.http_build_query($query_array);
}
$location = modify_url(array('client_id' => 6813c5d125013568ef986b73e4ba265c), $location);
$json = file_get_contents($location);
$obj = json_decode($json);
echo $obj->id;
?>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 5.4.24 0.005 0.036 12.42 5.4.23 0.009 0.035 12.41 5.4.22 0.006 0.041 12.41 5.4.21 0.004 0.038 12.41 5.4.20 0.006 0.038 12.41 5.4.19 0.004 0.038 12.41 5.4.18 0.004 0.037 12.41 5.4.17 0.004 0.038 12.42 5.4.16 0.005 0.036 12.41 5.4.15 0.007 0.035 12.41 5.4.14 0.004 0.038 12.10 5.4.13 0.004 0.037 12.08 5.4.12 0.005 0.038 12.04 5.4.11 0.004 0.036 12.04 5.4.10 0.005 0.035 12.04 5.4.9 0.007 0.036 12.04 5.4.8 0.007 0.039 12.04 5.4.7 0.005 0.035 12.04 5.4.6 0.007 0.033 12.04 5.4.5 0.004 0.036 12.04 5.4.4 0.006 0.038 12.02 5.4.3 0.007 0.039 12.02 5.4.2 0.006 0.035 12.02 5.4.1 0.008 0.032 12.02 5.4.0 0.005 0.036 11.51 5.3.28 0.005 0.042 12.72 5.3.27 0.007 0.038 12.73 5.3.26 0.008 0.038 12.73 5.3.25 0.005 0.040 12.73 5.3.24 0.009 0.036 12.73 5.3.23 0.005 0.040 12.72 5.3.22 0.011 0.034 12.69 5.3.21 0.009 0.039 12.69 5.3.20 0.007 0.038 12.69 5.3.19 0.007 0.039 12.69 5.3.18 0.006 0.037 12.68 5.3.17 0.006 0.037 12.68 5.3.16 0.005 0.036 12.68 5.3.15 0.005 0.043 12.69 5.3.14 0.005 0.038 12.67 5.3.13 0.008 0.037 12.67 5.3.12 0.007 0.044 12.67 5.3.11 0.005 0.039 12.67 5.3.10 0.007 0.035 12.14 5.3.9 0.005 0.039 12.12 5.3.8 0.005 0.036 12.11 5.3.7 0.007 0.038 12.11 5.3.6 0.004 0.038 12.09 5.3.5 0.007 0.035 12.04 5.3.4 0.005 0.040 12.04 5.3.3 0.007 0.036 12.01 5.3.2 0.008 0.035 11.79 5.3.1 0.005 0.037 11.75 5.3.0 0.005 0.039 11.74
preferences:dark mode live preview
138.18 ms | 1446 KiB | 7 Q