Brad Fletcher
Brad Fletcher

Reputation: 3593

PUT / Soundcloud API with cURL

I'm using this code to get a user but how do it "like" a track via a PUT request in cURL & PHP?

// build our API URL
$url = "http://api.soundcloud.com/resolve.json?"
 . "url=http://soundcloud.com/"
 . "USERNAME-HERE"
 . "&client_id=CLIENT-ID-HERE";

// Grab the contents of the URL
$user_json = file_get_contents($url);

// Decode the JSON to a PHP Object
$user = json_decode($user_json);

// Print out the User ID
echo $user->id;

Upvotes: 0

Views: 337

Answers (1)

BadHorsie
BadHorsie

Reputation: 14544

See SoundCloud API Documentation - /users.

You can favourite a track for a user with a PUT request in the following format:

/users/{user_id}/favorites/{track_id}

If you don't know how to make the cURL request, Google it - there are hundreds of tutorials and answers on StackOverflow. Here is one example:

Querying API through Curl/PHP

Upvotes: 1

Related Questions