PHP code example of mremi / dolist

1. Go to this page and download the library: Download mremi/dolist 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/ */

    

mremi / dolist example snippets




use Mremi\Dolist\Authentication\AuthenticationManager;
use Mremi\Dolist\Authentication\AuthenticationRequest;
use Mremi\Dolist\Contact\ContactManager;
use Mremi\Dolist\Contact\FieldManager;

$contactSoapClient = new \SoapClient('http://api.dolist.net/v2/ContactManagementService.svc?wsdl', array(
    'soap_version'       => SOAP_1_1,
    'trace'              => true,
    'connection_timeout' => 2,
    // ...
));
$authSoapClient = new \SoapClient('http://api.dolist.net/v2/AuthenticationService.svc?wsdl', array(
    'soap_version'       => SOAP_1_1,
    'trace'              => true,
    'connection_timeout' => 2,
    // ...
));
$authRequest = new AuthenticationRequest('YOUR_ACCOUNT_IDENTIFIER', 'YOUR_AUTHENTICATION_KEY');
$authManager = new AuthenticationManager($authSoapClient, $authRequest, 3);

$contactManager = new ContactManager($contactSoapClient, $authManager, 3);
$fieldManager   = new FieldManager;

$contact = $contactManager->create();
$contact->setEmail('[email protected]');
$contact->addField($fieldManager->create('firstname', 'Firstname'));
$contact->addField($fieldManager->create('lastname', 'Lastname'));

$ticket = $contactManager->save($contact);

$saved = $contactManager->getStatusByTicket($ticket);

if ($saved->isOk()) {
    // contact has been saved...
} else {
    // something is wrong...
    echo sprintf('Returned code: %s, description: %s', $saved->getReturnCode(), $saved->getDescription());
}



use Mremi\Dolist\Contact\GetContactRequest;

$request = new GetContactRequest;
$request->setOffset(50);
// ...
$contacts = $contactManager->getContacts($request);
// ...
 bash
$ php composer.phar update mremi/dolist