PHP code example of rde / api

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

    

rde / api example snippets

 php
    $api = new Rde\Api(array(
        'protocol' => Rde\Api::guessProtocol(),
        'host' => Rde\Api::guessHost(),
        'ip' => Rde\Api::guessIp(),
        'port' => Rde\Api::guessPort(),
        'path' => 'base/api/path',
        'auth_basic_user' => 'xxx',
        'auth_basic_pwd' => 'xxxxxxxxxxx',
    ));

    $data = $api->get(
        'test/api', 
        array("a" => "b"), 
        function($body, $response, array("method" => 'GET', "payload" => array("a" => "b"))){
            // accept callback
        },
        function($code, $err_msg, $res_raw_body, $exception){
            // reject callback
        },
        function($request){
            // profile callback
            // just for test
        }
    );