This PHP script demonstrates how to interact with the Zoho CRM API to perform the following operations:
- Generate a Refresh Token
- Generate an Access Token
- Insert Leads
- Retrieve Leads
- PHP 7.4 or higher
- cURL extension enabled in PHP
- Zoho CRM account
- OAuth credentials (client ID, client secret, redirect URI, and authorization code)
-
Clone the Repository
Copy the PHP script to your project directory. -
Configure Zoho OAuth Credentials
Update the placeholders in the$post
arrays for thegenerate_refresh_token()
andgenerate_access_token()
functions:client_id
client_secret
redirect_uri
code
(authorization code for refresh token generation)refresh_token
(for access token generation)
-
Update API Endpoints
Ensure the Zoho API URLs match your region:- Default:
https://accounts.zoho.com
- Other regions:
https://accounts.zoho.eu
(Europe)https://accounts.zoho.in
(India)
- Default:
-
Update Access Token
Replace the$access_token
variable ininsert_leads()
andget_records()
with the valid access token generated bygenerate_access_token()
. -
Run the Script
Execute the PHP script from the command line or integrate it into your application.php script.php