PHP code example of websupport / api_php

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

    

websupport / api_php example snippets


$api = new \websupport\RestConnection('https://rest.websupport.sk/v1/', 'login', 'pass');

// load user info
try {
	$userInfo = $api->get('user/self'); 
	var_dump($userInfo);
} catch (\websupport\RestException $e) {
	var_dump($e); // error via exception
}

// ordering domain
try {
	$orderInfo = $api->post('user/self/order', array(
		"services"=>array(
			array('type'=>'domain', 'domain'=>'newdomain.com')
		)
	));
	var_dump($orderInfo);
} catch (\websupport\RestException $e) {
	var_dump($e); // error via exception
}

sh
composer