contact360 / php-api
Contact360 API连接层
1.3.1
2024-05-15 19:13 UTC
Requires
- php: >=5.3.0
- ext-curl: *
- ext-json: *
README
用于Contact360 API通信的入口类。
目录
安装/要求
要求
- 在
使用Composer安装
- 需要composer包
composer require contact360/php-api - 在您的代码中包含引用
use Contact360\API; require 'vendor\autoload.php';
手动安装
- 将此存储库作为ZIP下载
- 解压缩并将其包含在您的代码中
功能
- 插入网页表单联系事件
- 插入网页购物车事件
用法/示例
用法
use Contact360\API;
$client_id = 'YOUR-CLIENT-ID';
$secret = 'YOUR-API-SECRET';
$APIClient = new API($client_id, $secret);
$form_name = 'Contact Page Form';
$enquiry_content = 'Equiry from your website:<br/>First Name: John\nLast Name: Doe';
$fields = [
'email' => 'example@example.org',
'phone' => '123087923',
'name' => 'John Doe',
//'firstname' => 'John', //alternative for single "name" field
//'lastname' => 'Doe', //alternative for single "name" field
];
$result = $APIClient->insertContactForm($form_name, $enquiry_content, $fields);
if($result){
echo 'Contact form event registered.';
}
else{
echo 'Could not communicate to API right now.';
}
示例
- 调试
$APIClient = new API($client_id, $secret, true); $result = $APIClient->insertContactForm($form_name, $enquiry_content, $fields); if(!$result){ var_dump($result->getCallResults()); }