Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- (c) 2015, made by;
- --
- Dwi Siswanto ([email protected])
- dwi-siswant0.blogspot.com
- --
- **/
- define("client_id", "02gUJC0hH2ct1EGOcYXQIzRFU91c72Ea"); // This is public "client id"
- function hajar($yuerel, $dataAing = null) {
- $cuih = curl_init();
- curl_setopt($cuih, CURLOPT_URL, $yuerel);
- if ($dataAing != null){
- curl_setopt($cuih, CURLOPT_POST, true);
- curl_setopt($cuih, CURLOPT_POSTFIELDS, $dataAing);
- }
- curl_setopt($cuih, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($cuih, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($cuih, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($cuih, CURLOPT_COOKIESESSION, true);
- $eks = curl_exec($cuih);
- curl_close($cuih);
- return $eks;
- }
- if (isset($argv[1])) {
- $meta = getInpoh($argv[1]);
- echo $meta;
- } else {
- echo "usage; this.php <soundcloud link>";
- exit;
- }
- function getInpoh($link) {
- echo "# Getting info: ";
- $data = json_decode(hajar("https://api.soundcloud.com/resolve.json?client_id=" . client_id . "&url=" . $link), true);
- if (isset($data['errors'])) {
- echo "ERROR!\n" . $data['errors'][0]['error_message'];
- exit;
- } else {
- echo "OK!\n";
- sleep(1);
- echo "Artis: " . $data['user']['username'];
- echo "\nTitle: " . $data['title'];
- echo "\nGenre: " . $data['genre'] . "\n\n";
- // echo "\nLink : " . $data['permalink_url'] . "\n\n";
- $dl = getDownload($data['uri']);
- }
- }
- function getDownload($link) {
- echo "# Getting download url: ";
- $data = json_decode(hajar($link . "/streams?client_id=" . client_id), true);
- if (isset($data['errors'])) {
- echo "ERROR!\n" . $data['errors'][0]['error_message'];
- } else {
- echo "OK!\n";
- echo "Link : " . $data['http_mp3_128_url'];
- }
- }
Add Comment
Please, Sign In to add comment