PHP code example of niland / api-client-php

1. Go to this page and download the library: Download niland/api-client-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

niland / api-client-php example snippets


// composer autoload
dApi\Client(YOUR_API_KEY);

$response = $client->get('tracks', array('page_size' => 10, 'page' => 2));

$response = $client->get('tracks/reference/YOUR_REFERENCE');

$response = $client->get('tracks/search', array(
    'similar_ids' => array(1234),
    'tag_ids'     => array(21, 41)
));

$response = $client->post('tracks', array(
    'title'     => 'foobar',
    'artist'    => 'foobar',
    'reference' => 'foobar',
    'tags'      => array(21, 41),
    'audio'     => fopen('/path/to/your/audio/file.mp3', 'r')
));

$response = $client->post('tracks', array(
    'title'     => 'foobar',
    'artist'    => 'foobar',
    'reference' => 'foobar',
    'tags'      => array(21, 41),
    'audio'     => fopen('http://myawesomewebsite.com/file.mp3', 'r')
));
bash
composer