PHP code example of mijnpartnergroep-nl / sidn-suggestion-api-php

1. Go to this page and download the library: Download mijnpartnergroep-nl/sidn-suggestion-api-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/ */

    

mijnpartnergroep-nl / sidn-suggestion-api-php example snippets



\Sidn\Suggestion\Api\Exceptions\ApiException;
use  \Sidn\Suggestion\Api\SidnSuggestionApiClient;

try {
    // Create new instance of SidnSuggestionApiClient
    $sidnApi = new SidnSuggestionApiClient();

    // Authenticate using Client Id and Client Secret provided by SIDN
    $auth = $sidnApi->authenticate->authenticate($client_id, $client_secret);
    $sidnApi->setAccessToken($auth->access_token);

    // Search for domain suggestions
    $suggestions = $sidnApi->suggestion->search("bike.nl", 1000);
    print_r($suggestions->suggestions);

    // Optionally, query the used configuration from the results
    print_r($suggestions->config);

    // Optionally, query the used domain (cleaned) from the results
    print_r($suggestions->original);
} catch (ApiException $ae) {
    echo "Error occured at: ".$ae->getTimestamp() . ";<br />Message: ".$ae->getMessage();
    throw $ae;
}