PHP code example of mctekk / zohocrm

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

    

mctekk / zohocrm example snippets




use Zoho\CRM\ZohoClient;

$ZohoClient = new ZohoClient(); // Make the connection to zoho api
$ZohoClient->setAuthRefreshToken(getenv('ZOHO_AUTH_REFRESH_TOKEN'));
$ZohoClient->setZohoClientId(getenv('ZOHO_CLIENT_ID'));
$ZohoClient->setZohoClientSecret(getenv('ZOHO_CLIENT_SECRET'));
$refresh = $ZohoClient->generateAccessTokenByRefreshToken();
//or with redis $ZohoClient->manageAccessTokenRedis($redis);

$this->zohoClient->setModule('Leads');

$lead = new Lead();

$leadRequest = [
	'First_Name' => 'Test',
	'Last_Name' => 'Zoho',
	'Phone' => '000000000',
	'Email' => '[email protected]'
];

$response = $this->zohoClient->insertRecords(
	$leadRequest,
	['wfTrigger' => 'true']
);

$response->getResponseData();


$ZohoClient = new ZohoClient(); // Make the connection to zoho api
$ZohoClient->setAuthRefreshToken(getenv('ZOHO_AUTH_REFRESH_TOKEN'));
$ZohoClient->setZohoClientId(getenv('ZOHO_CLIENT_ID'));
$ZohoClient->setZohoClientSecret(getenv('ZOHO_CLIENT_SECRET'));
$refresh = $ZohoClient->generateAccessTokenByRefreshToken();
$ZohoClient->setEuDomain();
$ZohoClient->setModule('Leads'); // Set the module