1. Go to this page and download the library: Download teamgate/php-api-sdk 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/ */
teamgate / php-api-sdk example snippets
$api = new \Teamgate\API([
'apiKey' => '_YOUR_ACCOUNT_API_KEY_', // located at account settings -> additional features -> external apps
'authToken' => '_YOUR_PERSONAL_AUTH_TOKEN_' // located at user settings -> preferences
]);
$result = $api->deals->get([
'offset' => 0,
'limit' => 10
]
);
var_dump($result);
$api = new \Teamgate\API([
'apiKey' => '_YOUR_ACCOUNT_API_KEY_', // located at account settings -> additional features -> external apps
'authToken' => '_YOUR_PERSONAL_AUTH_TOKEN_' // located at user settings -> preferences
]);
$result = $api->leads->create(
[
'title' => 'The Company Name'
]
);
var_dump($result);
try
{
$api = new \Teamgate\API([
'apiKey' => '_YOUR_ACCOUNT_API_KEY_', // located at account settings -> additional features -> external apps
'authToken' => '_YOUR_PERSONAL_AUTH_TOKEN_' // located at user settings -> preferences
]);
$result = $api->leads->create(
[
'title' => 'The Company Name'
]
));
var_dump($result);
}
catch (Teamgate\Exception\ValidationException $e)
{
/* Invalid client configuration */
}
catch (Teamgate\Exception\TransportException $e)
{
var_dump($e->getCode()); // HTTP Status Code
var_dump($e->output); // Teamgate API Output
}
catch (Teamgate\Exception\ResponseException $e)
{
/* Invalid query parameters or etc. */
}
catch (Exception $e)
{
/* Other kind of exception */
}
$api = new \Teamgate\API([
'apiKey' => '_YOUR_ACCOUNT_API_KEY_', // located at account settings -> additional features -> external apps
'authToken' => '_YOUR_PERSONAL_AUTH_TOKEN_' // located at user settings -> preferences
]);
$result = $api->companies->get([
'offset' => 0,
'limit' => 10
]
);
foreach($result as $company) {
if (!empty($company->data['urls']) && !empty($company->data['urls'][0] && !empty($company->data['urls'][0]['value']))
{
list($domain) = parse_url($company->data['urls'][0]['value'], PHP_URL_HOST);
$logo = file_get_contents('https://logo.clearbit.com/' . $domain);
if ($logo) {
$company->changeLogo(
[
'size' => strlen($logo),
'content' => base64_encode($logo)
]
);
}
}
}
var_dump($result);