servicein/leadclient

用于向 Servicein/CloudCare 发送客户的 PHP 客户端

1.0.2 2017-01-16 10:57 UTC

This package is not auto-updated.

Last update: 2024-09-23 16:06:26 UTC


README

Lead Client 是一个 PHP 客户端,使得在 Servicein/Cloudcare 中发送线索变得简单。

此库需要额外的信息才能运行,您必须定义三个常量

  • API_URL
  • API_KEY
  • DEFAULT_CAMPAIGN

常量的值需要向商业部门咨询。

define("API_URL", "**asked to the commercial department**");
define("API_KEY", "**asked to the commercial department**");
define("DEFAULT_CAMPAIGN", "**asked to the commercial department**");
//define("PROXY", "tpc://xxx.xxx.xxx.xxx:3128");
$lead = new Lead();
$lead->setFirstname("Tester")
        ->setLastname("Tester")
        ->setMail("tester@test.com")
        ->setPhone("33333333333")
        ->setCity("Roma")
        ->setProvince("RM")
        ->setSex("M")
        ->setNote("Nota");
        # set other campaign 
        ->setCampaign("OTHER_CAMPAIGN") 
try{
    $leadClient = new Client($lead);
    $result = $leadClient->sendLead();
    if($result->isValid()){
        echo "Lead successfully loaded".PHP_EOL;
    }else{
        echo "Error: ".$result->message.PHP_EOL;
    }
} catch (Exception $ex) {
    echo $ex->getMessage().PHP_EOL;
}

安装 Lead Client

推荐通过 Composer 安装客户端。

# Install Composer
curl -sS https://getcomposer.org/installer | php

接下来,运行 Composer 命令安装客户端的最新稳定版本

php composer.phar require servicein/leadclient

安装后,您需要引入 Composer 的自动加载器

require 'vendor/autoload.php';

然后您可以使用 composer 更新客户端

composer.phar update