PHP code example of leroy-merlin-br / exacttarget-client

1. Go to this page and download the library: Download leroy-merlin-br/exacttarget-client 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/ */

    

leroy-merlin-br / exacttarget-client example snippets



$guzzleClient   = new \GuzzleHttp\Client();
$requestBuilder = new \LeroyMerlin\ExactTarget\RequestBuilder($guzzleClient);
$token          = new \LeroyMerlin\ExactTarget\Token('YOUR_CLIENT_ID', 'YOUR_CLIENT_SECRET', $requestBuilder);
$client         = new \LeroyMerlin\ExactTarget\Client($token, $requestBuilder);

$parameters = [
    // optional
    // 'some-url-param' => 'some-value'
    'data' => [
        'email' => '[email protected]',
        'validators' => ['SyntaxValidator', 'MXValidator', 'ListDetectiveValidator'],
    ],
];

try {
    $response = $client->validateEmail($parameters);
    var_dump((string) $response->getBody());
} catch (\LeroyMerlin\ExactTarget\Exception\ExactTargetClientException $error) {
    var_dump($error->getCode(), $error->getMessage());
}

$client = app(\LeroyMerlin\ExactTarget\Client::class);

// As in https://code.exacttarget.com/apis-sdks/rest-api/v1/address/validateEmail.html
$parameters = [
    // optional
    // 'some-url-param' => 'some-value'
    'data' => [
        'email' => '[email protected]',
        'validators' => ['SyntaxValidator', 'MXValidator', 'ListDetectiveValidator'],
    ],
];

try {
    $response = $client->validateEmail($parameters);
    var_dump((string) $response->getBody());
} catch (\LeroyMerlin\ExactTarget\Exception\ExactTargetClientException $error) {
    var_dump($error->getCode(), $error->getMessage());
}

$client = App::make('LeroyMerlin\ExactTarget\Client');

// As in https://code.exacttarget.com/apis-sdks/rest-api/v1/address/validateEmail.html
$parameters = [
    // optional
    // 'some-url-param' => 'some-value'
    'data' => [
        'email' => '[email protected]',
        'validators' => ['SyntaxValidator', 'MXValidator', 'ListDetectiveValidator'],
    ],
];

try {
    $response = $client->validateEmail($parameters);
    var_dump((string) $response->getBody());
} catch (\LeroyMerlin\ExactTarget\Exception\ExactTargetClientException $error) {
    var_dump($error->getCode(), $error->getMessage());
}