This repository has been archived by the owner on Feb 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from methylbro/documentation
Documentation
- Loading branch information
Showing
53 changed files
with
1,873 additions
and
547 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,18 +3,19 @@ | |
```php | ||
<?php | ||
|
||
use Mediapart\Selligent\Connection; | ||
use Mediapart\Selligent\Response; | ||
use Mediapart\Selligent\List; | ||
use Mediapart\Selligent\Property; | ||
use Mediapart\Selligent\ArrayOfProperty; | ||
namespace Mediapart\Selligent; | ||
|
||
|
||
/* | ||
Open a connection to Selligent. | ||
*/ | ||
$connection = new Connection(); | ||
$client = $connection->open($login, $password, $wsdl); | ||
|
||
|
||
/* output lists infos */ | ||
/* | ||
Output lists infos. | ||
*/ | ||
$response = $client->GetLists(); | ||
|
||
if (Response::SUCCESSFUL === $response->getCode()) { | ||
|
@@ -29,34 +30,72 @@ if (Response::SUCCESSFUL === $response->getCode()) { | |
} | ||
|
||
|
||
/* register a new user */ | ||
/* | ||
Register a new user. | ||
*/ | ||
$user = new Properties(); | ||
$user[] = new Property('NAME', 'Thomas Gasc'); | ||
$user[] = new Property('MAIL', '[email protected]'); | ||
$user['NAME'] = 'Foo Bar'; | ||
$user['MAIL'] = '[email protected]'; | ||
|
||
$response = $client->CreateUser([ | ||
'List' => $list->getId(), | ||
'Changes' => $user, | ||
]); | ||
|
||
if (Response::SUCCESSFUL === $response->getCode()) { | ||
$user_id = $response->ID; | ||
printf("saved with id=%d\n", $user_id); | ||
$idUser = $response->getUserId(); | ||
printf("saved with id=%d\n", $idUser); | ||
} | ||
|
||
|
||
/* update user info */ | ||
$updatedUser = new ArrayOfProperty(); | ||
$updatedUser[] = new Property('NAME', 'Thomas Gasc Test'); | ||
$updatedUser[] = new Property('MAIL', '[email protected]'); | ||
/* | ||
Update user info. | ||
*/ | ||
$changes = new Properties(); | ||
$changes['NAME'] = 'Foo Bar'; | ||
$changes['MAIL'] = '[email protected]'; | ||
|
||
$response = $client->UpdateUser([ | ||
'List' => $list->getId(), | ||
'UserID' => $user_id, | ||
'Changes' => $updatedUser, | ||
'UserID' => $idUser, | ||
'Changes' => $changes, | ||
]); | ||
|
||
if (Response::SUCCESSFUL === $response->getCode()) { | ||
printf("%d updated\n", $user_id); | ||
printf("%d updated\n", $idUser); | ||
} | ||
``` | ||
|
||
|
||
/* | ||
Trigger a campaign TESTGATE to $idUser with a | ||
custom var MESSAGE. | ||
*/ | ||
$nameGate = 'TESTGATE'; | ||
$nameList = 'TESTLIST'; | ||
|
||
$response = $this->client->GetListID([ | ||
'name' => $nameList, | ||
]); | ||
|
||
if (Response::SUCCESSFUL === $response->getCode()) { | ||
|
||
$idList = $response->getId(); | ||
|
||
$inputData = new Properties(); | ||
$inputData['MESSAGE'] = 'Lorem ipsum dolor sit amet.'; | ||
|
||
$response = $client->TriggerCampaignForUserWithResult([ | ||
'List' => $idList, | ||
'UserID' => $idUser, | ||
'GateName' => $nameGate, | ||
'InputData' => $inputData, | ||
]); | ||
|
||
if (Response::SUCCESSFUL === $response->getCode()) { | ||
printf("The message has been sent to user #%d.", $idUser); | ||
} | ||
|
||
} else { | ||
printf("Error with the '%s' list.", $nameList); | ||
} | ||
``` |
Oops, something went wrong.