Get All Records of Zoho CRM by Using PHP Curl

Access Zoho API using PHP Curl

Access Zoho API and Fetch all Zoho CRM records after create Zoho Postman Access token and refresh token with create PHP Curl.

Fetch Zoho CRM Data using API

<?php

$url = "https://accounts.zoho.in/oauth/v2/token?refresh_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&client_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&client_secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&grant_type=refresh_token";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
$output = json_decode($result, true);
$access_token = $output['access_token'];
echo $access_token;
echo '<br />';
?>

For Above code you get the Zoho Access Code

 

By using below PHP code get all leads records thru using PHP Curl and result will print in your browser with JSON format

<?php 
$headerTwo =array("Authorization: Zoho-oauthtoken $access_token");
$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, "https://www.zohoapis.in/crm/v2/Leads");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headerTwo);
$return = curl_exec ($curl);
curl_close ($curl);

$outputZoho = json_decode($return, true);

echo '<pre>';
print_r($outputZoho);
echo '</pre>';
?>