basebuy / basebuy-sdk-php
BasebuyAutoApi 的包装器
1.0.0
2017-08-09 22:18 UTC
Requires
This package is not auto-updated.
Last update: 2024-09-12 00:59:48 UTC
README
要求
PHP 5.3 或更高版本
链接
入门
安装
- 将仓库克隆到您的项目中。
- 粘贴以下代码
require_once '/path/to/cloned/repo/BasebuyAutoApi.php';
使用 BaseBuy.Auto API 需要以下步骤
-
在 http://basebuy.ru 购买数据库以获取 API_KEY(令牌)。注意:
API_KEY
是您用于访问 BaseBuy.Auto API 的常量。 -
之后您就可以使用 BaseBuy.Auto API。
$basebuyAutoApi = new BasebuyAutoApi( new CurlGetConnector( API_KEY ) ); // check last information update date $basebuyAutoApi->typeGetDateUpdate(); // get database file $downloadedFilePath = $basebuyAutoApi->typeGetAll(); // catch error codes } catch( Exception $e ){ if ( $e->getCode() == 401 ) ... }
备注
-
在以下情况下库会抛出异常
* response status isn't equal 2** * I/O error(see [requests](https://github.com/rmccue/Requests))
运行测试
- 克隆此仓库。
- 安装 composer
- 运行
composer install
- 创建包含
API_KEY
常量的sample.php
文件。 - 运行它