PHP code example of amocrmtech / client
1. Go to this page and download the library: Download amocrmtech/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/ */
amocrmtech / client example snippets
$client = ClientFactory::buildCookies([
'subdomain' => 'your_subdomain',
'login' => 'your_login',
'token' => 'your_token',
'cookiesFile' => '@runtime/amocrmtech/cookies_{subdomain}.bin', // не обязательно, по умолчанию - такой
]);
$request = $client->get(['account']);
$response = $request->send();
$data = $response->data;
$client = ClientFactory::buildOAuth([
'subdomain' => 'your_subdomain',
'accessToken' => 'your_access_token', // не обязательно, будет получен при запросе
'refreshToken' => 'your_refresh_token',
'redirectUri' => 'your_redirect_uri',
'integrationId' => 'your_integration_id',
'secretKey' => 'your_secret_key',
]);
$request = $client->get(['account']);
$response = $request->send();
$data = $response->data;
//...
'components' => [
'amoClient' => ClientFactory::lazyCookies([
'subdomain' => 'your_subdomain',
'login' => 'your_login',
'token' => 'your_token',
]),
],
// ...
//...
'components' => [
'amoClient' => static function(){
return ClientFactory::buildCookies([
'subdomain' => $params['your_subdomain'],
'login' => $params['your_login'],
'token' => $params['your_token'],
]);
},
],
// ...