markmarushak/curlapi

通过curl请求连接到API

dev-master 2018-12-13 14:12 UTC

This package is auto-updated.

Last update: 2024-09-14 03:48:29 UTC


README

Build Status Latest Stable Version Total Downloads License

此仓库包含开源PHP代码,允许您访问REST API

安装

可以使用 Composer 安装Curl API。运行以下命令:

composer require markmarushak/curlapi

用法

注意: 此版本的PHP curl API SDK需要PHP 5.6或更高版本。

示例

$argument_1 = 'test@example.com';
$argument_2 = 'test';

$client = new Voluum\Client\API(new Voluum\Auth\PasswordCredentials($argument_1, $argument_2));

$report_api = new Voluum\API($client);

或使用访问ID和密钥

$access_key_id = "access_key_id";
$access_key = "access_key";

$client = new Voluum\Client\API(new Voluum\Auth\AccessKeyCredentials($access_key_id, $access_key));

$report_api = new Voluum\API($client);

如何获取报告

$result = $report_api->get("report", [
   "from" => date("Y-m-d"),
   "to" => date("Y-m-d"),
   "groupBy" => "campaign"
]);

//Get result as json
echo $result->getJson();

//Get result as object
var_dump($result->getData());

创建新的lander

$result = $report_api->post("lander", [
   "namePostfix" => "Test",
   "url" => "http://example.com"
]);

编辑lander

$result = $report_api->put("lander/xxxxx-xxxxxx-xxxxxx-xxxxx", [
   "namePostfix" => "Test 1",
   "url" => "http://example.com"
]);

删除lander

$result = $report_api->delete("lander", [
   "ids" => "xxxxx-xxxxxx-xxxxxx-xxxxxx"
]);

voluum文档!在此。adsBridge文档在此

许可证

有关更多信息,请参阅许可证文件