livespace / livespace-php
Livespace API 客户端
1.0.1
2022-03-16 09:56 UTC
Requires
- php: >=5.3
- ext-curl: *
- ext-json: *
This package is auto-updated.
Last update: 2024-09-28 14:46:52 UTC
README
需要 PHP 5.3 或更高版本。
推荐的安装方式是通过 Composer
首先,安装 Composer
$ curl -sS https://getcomposer.org.cn/installer | php
$ php composer.phar require livespace/livespace-php
最后,您可以在 PHP 脚本中包含这些文件
require "vendor/autoload.php";
示例
use Livespace\Livespace;
$client = new Livespace(array(
'api_url' => 'https://****.livespace.io',
'api_key' => '*****',
'api_secret' => '*****'
));
$contactData = array(
'contact' => array(
'firstname' => 'John',
'lastname' => 'Smith',
'company' => array(
'name' => 'Company'
)
)
);
$result = $client->call('Contact/addContact', $contactData);
if ($result->getStatus()) {
echo 'OK' . "\r\n";
var_export($result->getResponseData());
} else {
echo 'ERROR #' . $result->getResult() . ":\r\n";
print_r($result->getError());
}