linuzilla/ncucc-coreapi

NCUCC CoreAPI Client

v1.0.2 2017-06-13 03:22 UTC

This package is not auto-updated.

Last update: 2024-05-07 15:29:16 UTC


README

ncucc-coreapi is a PHP HTTP client

php composer.phar require linuzilla/ncucc-coreapi
<?php
require __DIR__ . '/vendor/autoload.php';

use NCUCC\CoreAPI\Client;
use NCUCC\CoreAPI\APIException;

$config_file = "config.json";
$config = json_decode(file_get_contents($config_file));

$coreapi = new Client($config);

try {
	$coreapi->some_api_function();
} catch (NCUCC\CoreAPI\APIException $e) {
	echo 'Caught exception: ',  $e->getMessage(), "\n";
}
{
    "base": "// API base URL",
    "appkey": "your app key",
    "magickey": "your magic key",
    "secret": "secret",
    "publicKey": "public key in pem format",
    "token": "access token",
    "apiMetaFile": "api meta file"
}