PHP code example of somework / expert-sender-api

1. Go to this page and download the library: Download somework/expert-sender-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

somework / expert-sender-api example snippets


$expertSender = new ExpertSender('https://api.esv2.com/', $apiKey);

$customProperty = new Property(1775, ExpertSenderEnum::TYPE_STRING, 'female');

$request = new AddUserToList();
$request
    ->setEmail('[email protected]')
    ->setListId(1000)
    ->setFirstName('my name');
    ->addProperty($customProperty)
    ->freeze();

$result = $expertSender->addUserToList($request);

if ($result->isOk()) {
    ...
} else {
    $requestData = $expertSender->getRequestData();
}