Solved

Soundcloud extract data from URL

Posted on 2013-06-26
3
1,469 Views
Last Modified: 2013-07-30
Hi,

i am building a website in which i would like to have an area where a user can copy and past the sharelink from soundcloud upload it to a database and have a loop echo out each of the urls onto a webpage for users to interact with.

there are a couple steps i was hoping i could get a hand with or some direction i have looked at the soundcloud api but it seems like they are trying to do more complicated stuff such as managing their soundcloud content via their own website. i believe what i am trying to accomplish is mush simpler.

1. the first step i want the admin to be able to simply go to soundcloud find  a soung they link copy and paste the share url into a form and submit it - i do not need any help with this-.

2. the admins url will then be stored on a database with a variety of different parameter such as artist, song image etc..

3. essentially the problem i run into is taking the url that the admin user is uploading to the database and extracting all the information to store onto the server.

i have looked at the soundcloud api and registered a new app to get my client code and client secret.

i am trying to test all of it in wamp before i make it public and it seems when i try and use the basic examples posted on the documentation of soundcloud i get errors relating to " Use of undefined constant CURLOPT_HEADER" which i assume it due to the undefined constant of $client = new Services_Soundcloud('YOUR_CLIENT_ID', 'YOUR_CLIENT_SECRET');
because it is on the line mentioned. i have followed the example on soundcloud via copy and pasted and put in the required documents but no luck.

could someone point in a direction of a tutorial or good aid that can help me "extract" the data from the "share url" such as artist, title, song id, etc. so i can echo them out in a manner i choice

thanks very much
0
Comment
Question by:M. Jayme Nagy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 82

Expert Comment

by:hielo
ID: 39281666
>>Use of undefined constant CURLOPT_HEADER
That would happen if your installation does not have curl enabled.  Create a file named info.php and put the following in it:

<?php
phpinfo();
?>

Load it, and look for the "curl" section.  It should have:
cURL support      enabled

If that is not the case, you will need to enable it.
0
 
LVL 6

Accepted Solution

by:
M. Jayme Nagy earned 0 total points
ID: 39356144
ANSWER:

<?php
  $json ='http://api.soundcloud.com/resolve.json?url';
  $track_url=..........;
  $client_id= -soundcloud id;  //need to register the app to get code
$full_listing=$json.$track_url."&client_id=".$client_id;
?>

this code will take the url of a given song and display the information pertaining to that song

Open in new window


$full_url is an JSON data and you will likely have to get_file_contents and then json_decode the data

i did it as such
		//TEST TO SEE IF THE CONTENTS ARE THERE
		$track_info= @file_get_contents($full_url);
		if($track_info == FALSE){
			//REFRESH
			$e_msg = "ERROR: The Soundcloud information could not be found";
			 reload(3000,"fail",$e_msg);

		}else{
		
		
		//GET THE FILE CONTENTS
		$track_info= file_get_contents($full_url);
	  	
		//CONVERT THE JSON QUERY TO PHP FORMAT
		$info_array = json_decode($track_info, TRUE);

var_dump($info_array)
}

Open in new window

reload is a function which inputs JS to reload the page and display and error
0
 
LVL 6

Author Closing Comment

by:M. Jayme Nagy
ID: 39366335
no one gave me a complete answer i had to find it out and i had no guidance from EE
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
In this article you will learn how to create a free basic website on Bitbucket, a git service provider. Polymer creates dynamic HTML components, which allow more flexibility than static HTML. This tutorial uses Ubuntu Linux but can also be done on W…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question