PHP code example of kkbox / kkboxopenapi

1. Go to this page and download the library: Download kkbox/kkboxopenapi 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/ */

    

kkbox / kkboxopenapi example snippets


use KKBOX\KKBOXOpenAPI\OpenAPI;

$clientID = 'YOUR_CLIENT_ID';
$clientSecret = 'YOUR_CLIENT_SECRET';
$openAPI = new OpenAPI($clientID, $clientSecret);

$openAPI->fetchAndUpdateAccessToken();

$response = $openAPI->search('Love');

$response = $openAPI->search('Love');
$searchResults = json_decode($response->getBody());
var_dump($searchResults->tracks->data);