webfacer / billowrap
billomat.net 数据API的PHP封装器
dev-master
2015-08-31 10:23 UTC
Requires
- php: >5.3
This package is auto-updated.
Last update: 2024-09-16 10:52:52 UTC
README
billoWrap
用于从billomat.net检索或更改数据。
参数
bmId
- 参数类型:字符串
描述:这是您在正确域名中登录使用的billomat ID。
bmApiKey
- 参数类型:字符串
描述:这是billomat API密钥。您可以在“认证”标题下找到如何激活您的API密钥。您可以在这里找到它 http://www.billomat.com/en/api/basics/
dataType
- 参数类型:布尔值
- 默认值:TRUE
描述:以JSON对象输出数据,否则为XML对象。您还可以使用NULL以HTML格式输出数据。
convertData
参数类型:布尔值 默认:FALSE
如果“TRUE”,则转换数据对象为数组。使用“NULL”获取HTML标题。
useSocket
注意:尚未准备好使用
- 参数类型:布尔值
- 默认:FALSE
描述:如果为真,则通过套接字发送请求,否则通过curl。
使用示例
现在让我们看看如何从“billomat API”检索数据,我们选择此示例以获取所有客户
require_once 'billowrap.php'; $bmId = 'YourBillomatID'; // this is your billomatID you use to login $bmApiKey = 'YourApiKey'; // the API Key you will got it from billomat settings check the explanation http://www.billomat.com/en/api/basics/ $dataType = true; // Set to true, to output JSON Object, false otherwise for XML Object $convertData = false; // Convert the JSON or XML data to Array, false otherwise for not converting the object $billoWrap = new billoWrap($bmId, $bmApiKey, $dataType, $convertData);
读取方法用于读取特殊数据或列出所有数据。
数据类型将与您在参数'dataType'中设置的值相同(查看变量$dataType的描述)
$id = 12345; // the id for special Client you want to show // Output all data from Client output will be which you deside in $dataType $singleData = $billoWrap->getSingleClient($id); print_r($singleData); // Output all data from Client $allData = $billoWrap->getAllClients(); print_r($allData);
添加方法用于添加特殊数据
// string for datatransfer you are using JSON or XML which you predefined on dataType for reques type data $data = '{ "client" : { "first_name" : "Max", "last_name" : "Mustermann" } }'; $billoWrap->addClient($data);
编辑方法用于编辑数据
// special client id integer $clientID = 1234; // send data which you want to edit same es add for dataType $data = '{ "client" : { "first_name" : "Mustermann", "last_name" : "Max" } }'; $billoWrap->editClient($clientID, $data);
删除方法用于删除数据
$clientID = 1234; // just say which client id you want to delete and it is done $billoWrap->delClient($clientID);