PHP code example of initworks / openprovider-php

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

    

initworks / openprovider-php example snippets




use OpenProvider\API;
use OpenProvider\Request;

$api = new API('https://api.openprovider.eu');

$request = new Request();
$request
    ->setCommand('checkDomainRequest')
    ->setAuth([ 'username' => '[username]', 'password' => '[password]' ])
    ->setArgs([
        'domains' => [
            [
                'name' => 'openprovider',
                'extension' => 'nl',
            ],
            [
                'name' => 'jouwweb',
                'extension' => 'nl'
            ],
        )
    ]);

$reply = $api->setDebug(1)->process($request);
echo "Code: " . $reply->getFaultCode() . "\n";
echo "Error: " . $reply->getFaultString() . "\n";
echo "Value: " . print_r($reply->getValue(), true) . "\n";
echo "\n---------------------------------------\n";

echo "Finished example script\n\n";