Lead Client
Lead Client is a PHP client that makes it easy to send Lead at Servicein/Cloudcare., (*1)
This library require an additional info for work, you must define three constants:
- API_URL
- API_KEY
- DEFAULT_CAMPAIGN, (*2)
The constant value should be asked to the commercial department., (*3)
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;
}
Installing Lead Client
The recommended way to install Client is through
Composer., (*4)
# Install Composer
curl -sS https://getcomposer.org/installer | php
Next, run the Composer command to install the latest stable version of Client:, (*5)
php composer.phar require servicein/leadclient
After installing, you need to require Composer's autoloader:, (*6)
require 'vendor/autoload.php';
You can then later update Client using composer:, (*7)
bash
composer.phar update
, (*8)