PHP code example of acl-solution / rh-dependency

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

    

acl-solution / rh-dependency example snippets


$api = new \ACL\RH\Dependency\Provider('https://example.com/whmcs/installation/url/', 'myusername', 'mypassword');

try {
    $result = $api->acceptOrder([
        'orderid' => 123,
        'serverid' => 456,
        //...
    ]);
} catch (\HansAdema\WhmcsSdk\RequestException $e) {
    echo "Error connecting to WHMCS: ".$e->getMessage();
} catch (\HansAdema\WhmcsSdk\ResponseException $e) {
    echo "There was an issue with your API call: ".$e->getMessage();
}



use ipinfo\ipinfo\IPinfo;

$access_token = '123456789abc';
$client = new IPinfo($access_token);
$ip_address = '216.239.36.21';
$details = $client->getDetails($ip_address);

$details->city; // Emeryville
$details->loc; // 37.8342,-122.2900

$client = new IPinfo();
$ip_address = '216.239.36.21';
$details = $client->getDetails($ip_address);
$details->city; // Emeryville
$details->loc; // 37.8342,-122.2900

$access_token = '123456789abc';
$client = new IPinfo($access_token);

$details->hostname; // cpe-104-175-221-247.socal.res.rr.com

$details->country; // US
$details->country_name; // United States

$details->loc; // 34.0293,-118.3570
$details->latitude; // 34.0293
$details->longitude; // -118.3570

$details->all;
/*
    {
    'asn': {  'asn': 'AS20001',
               'domain': 'twcable.com',
               'name': 'Time Warner Cable Internet LLC',
               'route': '104.172.0.0/14',
               'type': 'isp'},
    'city': 'Los Angeles',
    'company': {   'domain': 'twcable.com',
                   'name': 'Time Warner Cable Internet LLC',
                   'type': 'isp'},
    'country': 'US',
    'country_name': 'United States',
    'hostname': 'cpe-104-175-221-247.socal.res.rr.com',
    'ip': '104.175.221.247',
    'loc': '34.0293,-118.3570',
    'latitude': '34.0293',
    'longitude': '-118.3570',
    'phone': '323',
    'postal': '90016',
    'region': 'California'
    }
*/

$access_token = '123456789abc';
$settings = ['cache_maxsize' => 30, 'cache_ttl' => 128];
$client = new IPinfo($access_token, $settings);

$access_token = '123456789abc';
$settings = ['cache' => $my_fancy_custom_cache];
$client = new IPinfo($access_token, $settings);

$access_token = '123456789abc';
$settings = ['cache_disabled' => true];
$client = new IPinfo($access_token, $settings);

$access_token = '123456789abc';
$client = new IPinfo($access_token);
$ips = ['1.1.1.1', '8.8.8.8', '1.2.3.4/country'];
$results = $client->getBatchDetails($ips);
echo $results['1.2.3.4/country']; // AU
var_dump($results['1.1.1.1']);
var_dump($results['8.8.8.8']);

Ip::get();

Ip::validate($ip);



use ACL\RH\Dependency\Ip;

Ip::get();

$ip = Ip::get();

Ip::validate($ip);