1. Go to this page and download the library: Download ardakilic/euromessage-php 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/ */
ardakilic / euromessage-php example snippets
$config = new Euromessage\Client($config);
$memberData = [
'key' => 'KEY_ID', // Unique identifier for the service
'value' => 'Value',
'demographic' => [ // Depends on your account's configuration
'E-Posta' => '[email protected]',
'Adınız' => 'John',
'Soyadınız' => 'Doe',
'Telefon' => '532.1234567',
// ....
],
];
// Whether the member will be subscribed and force updated? These parameters are `true` as default, and optional. No need to set every time.
$subscribeEmail = true;
$subscribeGSM = true;
$forceUpdate = true; // If set to true, if the key value pair matches a current member, it updates
try {
$response = $euromessage->createMember($memberData, $subscribeEmail, $subscribeGSM, $forceUpdate);
} catch (Exception $e) {
if($e instanceof \GuzzleHttp\Exception\RequestException) {
// Guzzle request exception
} else {
// Class's exception, wrong credentials etc.
}
// The code and message are according to the Euromessage API
var_dump($e->getCode(), $e->getMessage(), $e->getTrace());
}
$config = new Euromessage\Client($config);
$memberData = [
'warehouseTableName' => 'your_warehouse_table_name', // The name of the data warehouse table on your system
'key' => 'KEY_ID', // Unique identifier for the service
'value' => 'Value',
'demographic' => [ // Depends on your account's configuration
'EMAIL' => '[email protected]',
'AD' => 'John',
'SOYAD' => 'Doe',
'GSMNO' => '532.1234567',
// ....
],
];
// Whether the member will be subscribed and force updated, or will the non-demographic fields be filled with blanks? These parameters are true as default, and optional. No need to set every time.
$subscribeEmail = true;
$subscribeGSM = true;
$forceUpdate = true; // If set to true, if the key value pair matches a current member, it updates
$insertEmptyValueForNonDemographicColumns = true;
try {
$response = $euromessage->createMemberAtWarehouse($memberData, $subscribeEmail, $subscribeGSM, $forceUpdate, $insertEmptyValueForNonDemographicColumns);
} catch (Exception $e) {
if($e instanceof \GuzzleHttp\Exception\RequestException) {
// Guzzle request exception
} else {
// Class's exception, wrong credentials etc.
}
// The code and message are according to the Euromessage API
var_dump($e->getCode(), $e->getMessage(), $e->getTrace());
}
$config = new Euromessage\Client($config);
$memberData = [
'key' => 'KEY_ID', // Unique identifier for the service
'value' => 'Value',
'lists' => [
[
'name' => 'List Name 1',
'group' => 'Group Name', // "Genel" may be set as default
],
],
];
try {
$response = $euromessage->addMemberToLists($memberData);
} catch (Exception $e) {
if($e instanceof \GuzzleHttp\Exception\RequestException) {
// Guzzle request exception
} else {
// Class's exception, wrong credentials etc.
}
// The code and message are according to the Euromessage API
var_dump($e->getCode(), $e->getMessage(), $e->getTrace());
}
$config = new Euromessage\Client($config);
$memberData = [
'key' => 'KEY_ID', // Unique identifier for the service
'value' => 'Value',
'lists' => [
[
'name' => 'List Name 1',
'group' => 'Group Name', // "Genel" may be set as default
],
],
];
try {
$response = $euromessage->removeMemberFromLists($memberData);
} catch (Exception $e) {
if($e instanceof \GuzzleHttp\Exception\RequestException) {
// Guzzle request exception
} else {
// Class's exception, wrong credentials etc.
}
// The code and message are according to the Euromessage API
var_dump($e->getCode(), $e->getMessage(), $e->getTrace());
}
$config = new Euromessage\Client($config);
$memberData = [
'key' => 'KEY_ID', // Unique identifier for the service
'value' => 'Value',
];
// When these parameters are set to true, memberData wants to contact with the channels
// If these parameters are set to false, memberData wants to unsubscribe from Email or GSM
$subscribeEmail = true;
$subscribeGSM = true;
try {
$response = $euromessage->updateNotificationPreferences($memberData, $subscribeEmail, $subscribeGSM);
} catch (Exception $e) {
if($e instanceof \GuzzleHttp\Exception\RequestException) {
// Guzzle request exception
} else {
// Class's exception, wrong credentials etc.
}
// The code and message are according to the Euromessage API
var_dump($e->getCode(), $e->getMessage(), $e->getTrace());
}
$config = new Euromessage\Client($config);
$memberData = [
'warehouseTableName' => 'your_warehouse_table_name', // The name of the data warehouse table on your system
'key' => 'KEY_ID', // Unique identifier for the service
'value' => 'Value',
];
// When these parameters are set to true, memberData wants to contact with the channels
// If these parameters are set to false, memberData wants to unsubscribe from Email or GSM
$subscribeEmail = true;
$subscribeGSM = true;
try {
$response = $euromessage->updateNotificationPreferencesAtDataWarehouse($memberData, $subscribeEmail, $subscribeGSM);
} catch (Exception $e) {
if($e instanceof \GuzzleHttp\Exception\RequestException) {
// Guzzle request exception
} else {
// Class's exception, wrong credentials etc.
}
// The code and message are according to the Euromessage API
var_dump($e->getCode(), $e->getMessage(), $e->getTrace());
}
$config = new Euromessage\Client($config);
$memberData = [
'key' => 'KEY_ID', // Unique identifier for the service
'value' => 'Value',
];
try {
$response = $euromessage->queryMemberDemography($memberData);
} catch (Exception $e) {
if($e instanceof \GuzzleHttp\Exception\RequestException) {
// Guzzle request exception
} else {
// Class's exception, wrong credentials etc.
}
// The code and message are according to the Euromessage API
var_dump($e->getCode(), $e->getMessage(), $e->getTrace());
}
$config = new Euromessage\Client($config);
$memberData = [
'warehouseTableName' => 'your_warehouse_table_name', // The name of the data warehouse table on your system
'key' => 'KEY_ID', // Unique identifier for the service
'values' => [
'Value', // You can query multiple values with this method from warehouse, that's why this is array.
// You can add more values like 'Value2', 'Value3' etc.
],
];
try {
$response = $euromessage->queryMemberDemographyFromDataWarehouse($memberData);
} catch (Exception $e) {
if($e instanceof \GuzzleHttp\Exception\RequestException) {
// Guzzle request exception
} else {
// Class's exception, wrong credentials etc.
}
// The code and message are according to the Euromessage API
var_dump($e->getCode(), $e->getMessage(), $e->getTrace());
}
$config = ew Euromessage\Client($config);
$newConfig =
$config = ew Euromessage\Client($config);
$newConfig = [
'username' => 'newUsername',
'password' => 'newPassword',
];
$euromessage->addConfig($newConfig);
// .. Do the rest
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.