dfcplc/dfcapi-php

DFC API - PHP

1.0.2 2016-03-03 14:37 UTC

This package is not auto-updated.

Last update: 2024-09-28 15:08:26 UTC


README

DFC API是一个Restful API,旨在简化与Debit Finance Collections Plc设置/修改/取消和查看直接借记的能力。

使用Composer安装

如果您使用Composer来管理依赖项,您可以使用它来安装DFC API客户端库。

{
  "require" : {
    "dfcplc/dfcapi-php" : "dev-master"
  },
  "autoload": {
    "psr-0": {"Dfcapi": "lib/"}
  }
}

从GitHub安装源代码

DFCAPI-PHP客户端库需要PHP v5.3+。从GitHub下载PHP库,并在脚本中按如下方式引用

安装源代码

$ git clone git@github.com:dfcplc/dfcapi-php.git 

并将其包含在您的脚本中

require_once '/path/to/dfcapi-php/lib/Dfcapi.php';

检查API凭证

您可能想知道如何使用Unirest使在PHP中创建请求更简单,让我们看看一个工作示例

$dfcapi = new Dfcapi();
$response = $dfcapi->CheckApiKey('TEST-TEST-TEST-TEST','a94a8fe5ccb19ba61c4c0873d391e987982fbbd3');

var_dump($response); // API Credential Check Response (true or false)

更多信息

在调用API时,可以使用以下方法检索额外的详细信息

$dfcapi = new Dfcapi();

$dfcapi->getErrors(); //Array of returned errors from the API Call

$dfcapi->getResponseCode(); //HTTP Response Code (200 = OK)

$dfcapi->getResponseBody(); //HTTP Response Body (Object)

$dfcapi->getResponseBodyRaw(); //HTTP Response Body (Raw)

$dfcapi->getResponseHeaders(); //HTTP Response Headers (Array)
### 感谢感谢以下人员:* [thefosk](https://github.com/thefosk) @ [mashape.com](https://mashape.com) - Unirest Restful Library