1. Go to this page and download the library: Download afaztech/ibsngrpc 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/ */
afaztech / ibsngrpc example snippets
use IBSNGrpc\Client;
// Initialize client
$ip = 'IBSNG_SERVER_IP';
$port = 'IBSNG_SERVER_PORT'; // Typically 1235
$username = 'USERNAME'; // e.g., 'system'
$password = 'PASSWORD';
$authType = 'ADMIN'; // Optional, default is 'ADMIN'
$ibsng = new Client($ip, $port, $username, $password, $authType);
// Example: Add a new user
$response = $ibsng->addNewUser(
$count = 1,
$credit = 1,
$group_name = '30d',
$owner_name = 'system',
$credit_comment = "Initial credit"
);
if ($response['success']) {
$userId = $response['data'][0];
echo "User created with ID: $userId";
} else {
throw new Exception("Error: " . $response['error']);
}
// Example: Change user password
$response = $ibsng->changePassword(
$userId,
'newusername',
'securepassword123'
);
if ($response['success']) {
echo "Username and password updated successfully!";
} else {
throw new Exception("Error: " . $response['error']);
}
[
'success' => bool, // Whether the operation was successful
'data' => mixed, // Response data if successful
'error' => string // Error message if unsuccessful
]
$response = $ibsng->getUserInfoByID(123);
if (!$response['success']) {
throw new Exception("Failed to get user info: " . $response['error']);
}
$userData = $response['data'];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.