PHP code example of reganface / rgp

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

    

reganface / rgp example snippets






$api_username = "apiname";	// add your api username here
$api_key = "apikey";		// add your api key here

try {
	$rgp = new reganface\RGP\RGP($api_username, $api_key);

	// do stuff

} catch (Exception $e) {
	// handle errors
}

[
	"data"  => [],			// The requested data
	"response"  => [],		// response information
	"pages"  => []			// pagination information (if applicable)
]

// Get some data. In this case, a list of all your facilities.
$result = $rgp->get("/facilities");

// The data will always be found in the "data" key.
$facilities  =  $result["data"];

// Output a list of each facility's three character code and the facility name.
if (!empty($facilities)) {
	foreach($facilities as $facility) {
		echo  "{$facility["code"]} - {$facility["name"]}\n";
	}
}

get (string $path [, array $params])

[
	"data" => array,			// this is the data you are looking for
	"response" => array,		// meta data about the response
	"pages" => [				// this will be here for any endpoints that return paginated data
		"itemTotal" => int,		// total number of results
		"itemPage" => int,		// number of results per page
		"pageTotal" => int,		// total number of pages
		"pageCurrent" => int	// the current page that was just returned
	]
]

get_raw (string $path [, array $params])

test ()