
<center><h2><strong>Ubuntu</strong></h2>
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
<!DOCTYPE html>
<html>
<?php

session_start();

error_reporting(E_ALL);
ini_set("display_errors", 0);
require "gestion.lib.php";

$CRouge = new CRouge();

$refresh_token  = "1000.fe3f0d89d1928355a5f8da32083669ba.e0ad331744b086fdc06eda48ea013e90";
$client_id      = "1000.KL48ACSNU2NS34520ESYY3FWZUBS0E";
$client_secret  = "3b4a8173e9dbd396aaeb2603db7560f5ff9a323bb6";

//  1/ Refresh le token initial

$refresh_token  = "1000.fe3f0d89d1928355a5f8da32083669ba.e0ad331744b086fdc06eda48ea013e90"; // Si l acces token change il faut changer ce code
$Url            = "https://accounts.zoho.com/oauth/v2/token?refresh_token=$refresh_token&client_id=$client_id&client_secret=$client_secret&grant_type=refresh_token";
$Param          = ['url'=>$Url,'method'=>'POST'];
$Result         = $CRouge->MyCurl_APIZOHO_V2($Param);
$Result         = json_decode($Result,TRUE );
$Token          = "Zoho-oauthtoken ".$Result['access_token'];

$Url            = "https://www.zohoapis.com/crm/v2/RIO/search?criteria=(Name:equals:".$_REQUEST['q'].")&page=1";
$Param2         = ['url'=>$Url,'method'=>'GET','header'=>["Authorization: $Token","contentType: application/json"]];
$Result         = $CRouge->MyCurl_APIZOHO_V2($Param2);
$Result         = json_decode($Result,TRUE );

$_SESSION['CROUGE']['rio'] = $Result['data'][0]['rio'];
echo $Result['data'][0]['rio'];
?>