PHP code example of syniah / onecrmclient

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

    

syniah / onecrmclient example snippets



 new OneCRM\Client('https://1crm.example.com/service/v4/rest.php', false);
try {
    $c->login('demo', 'demo');
    echo $c->listModules();
    //Find the first 10 accounts
    $response = $c->call(
        'Accounts',
        'get_entry_list',
        array('select_fields' => array('id', 'name'), 'max_results' => 10)
    );
    foreach ($response->entry_list as $item) {
        foreach ($item->name_value_list as $field) {
            echo $field->name, ': ', $field->value . " ";
        }
        echo "\n";
    }
} catch (OneCRM\Exception $e) {
    echo 'An error occurred: '. get_class($e) . ': ' . $e->getMessage();
}

$c = new OneCRM\Client($endpoint, function ($msg) {
    echo var_export($msg, true) . "\n";
});