Giter Site home page Giter Site logo

internalsystemerror / php-soundcloud Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ben-xo/php-soundcloud

7.0 7.0 3.0 126 KB

API Wrapper for SoundCloud written in PHP with support for authentication using OAuth 2.0.

Home Page: http://soundcloud.qvister.se

PHP 100.00%

php-soundcloud's People

Contributors

artwist avatar ben-xo avatar glenscott avatar hmanprod avatar internalsystemerror avatar josecanhelp avatar kalys avatar lynicidn avatar por avatar srhaber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

kalys mrhash libsyn

php-soundcloud's Issues

Array arguments not wrapped in quotes

In laravel 4 when I load php-soundcloud I get the following error: Use of undefined constant CURLOPT_HEADER - assumed 'CURLOPT_HEADER'.
I assumed the error was in Service.php when array arguments without quotes are used.
These are:
line 87:
private static $_curlDefaultOptions = array(
CURLOPT_HEADER => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERAGENT => ''
);

line 898:
$this->_buildDefaultHeaders(), $curlOptions[CURLOPT_HTTPHEADER]

line 913
if (array_key_exists('CURLOPT_HEADER', $options) && $options['CURLOPT_HEADER'])

Couldn't upload that sound.

When I try to upload audio file to soundcloud, It throws error.

Here is my code:

$SC = new Soundcloud/Service('id','secret','redirect_uri');

$track = array(
    'track[title]' => 'My awesome track',
    'track[tags]' => 'testing',
    'track[asset_data]' => '@/home/vagrant/Code/livecenter/public/test.mp3'
);

try {
    $response = $SC->post('tracks', $track);
    return $response;
} catch(\Soundcloud\Exception\InvalidHttpResponseCodeException $e) {
    return $e->getHttpBody();
}

And this is the error, I'm receiving

{"errors":[{"error_message":"Couldn't upload that sound."},{"error_message":"Couldn’t upload that file, sure they’re valid soundfiles?"}]}

Getting a 422 error when trying to upload a file?

        $soundcloud = new \Soundcloud\Service(env('SOUNDCLOUD_ID'), env('SOUNDCLOUD_SECRET'));
        $soundcloud->setAccessToken('xxxxxxxxxxxxxxxxxxxxxx');

        $path = storage_path('app/test.mp3');

        $track = [
            'track[title]' => 'My amazing cool track',
            'track[tags]' => 'dubstep rofl',
            'track[asset_data]' => "@{$path}"
        ];

        try {
            return $soundcloud->post('tracks', $track);
        } catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
            exit($e->getMessage());
        }

Any ideas?

The requested URL responded with HTTP code 302.

get() throw an exception trying to resolve SoundCloud URL

Soundcloud\Exception\InvalidHttpResponseCodeException: The requested URL responded with HTTP code 302.

$data = $service->get('resolve.json', array('url' => $url));

To fix it you need to add the CURL option:

$data = $service->get('resolve.json', array('url' => $url, array(
    CURLOPT_FOLLOWLOCATION => true
));

Is there a reason why CURLOPT_FOLLOWLOCATION is not true by default?

How can I correctly download a file?

Hello,

I'm attempting to save a file locally on my server using the download() method this wrapper provides.

Here's what I currently have;

$soundcloud = new SoundCloud(
    getenv('SC_CLIENT_ID'),
    getenv('SC_CLIENT_SECRET')
);

$tracks = json_decode($soundcloud->get('users/{myId}/favorites'));

foreach($tracks as $track) {

    if($track->downloadable) {

        $track = $soundcloud->download($track->id);

        // How can I save $track - to my server?
    }
}

As you can see, I'm fetching a user (my owns) favourites - checking to see if a download if available, this is where I'd like to download it to my server.

How can I achieve this?

Ignores CURLOPT_FOLLOWLOCATION = false

The use of the _curlExecFollow for all get requests ignores cases where FOLLOWLOCATION is set to false, making setting it pointless!

This is a pretty nasty surprise as this behaviour is different to mptre/php-soundcloud

Catch Exception in get()

You throw an Exception in the _request function but don't catch it in the get function do it like this

$url = $this->_buildUrl($path, $params);

        try {
            $this->_request($url, $curlOptions);
        } catch(\Exception $e) {
            throw new ....
        }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.