CHANGE_API domain to zohoapis.com

This commit is contained in:
VE10-Sanjeev 2024-05-29 03:32:58 +00:00
parent eb6e874fe1
commit 098af23078

View File

@ -48,7 +48,8 @@ if (! function_exists('getheringInvoiceDetails')) {
// Zoho API credentials
$organization_id = '776847408';
$url_org = "https://books.zoho.com/api/v3/invoices?";
// $url_org = "https://books.zoho.com/api/v3/invoices?";
$url_org = "https://zohoapis.com/api/v3/invoices?";
// Construct query parameters
$fields = array(
@ -93,8 +94,8 @@ if (! function_exists('getheringInvoiceSubDetails')) {
$ch = curl_init();
// Construct URL for invoice sub-details
$url2 = 'https://books.zoho.com/api/v3/invoices/'.$invoice_id.'?organization_id='.$organization_id;
// $url2 = 'https://books.zoho.com/api/v3/invoices/'.$invoice_id.'?organization_id='.$organization_id;
$url2 = 'https://zohoapis.com/api/v3/invoices/'.$invoice_id.'?organization_id='.$organization_id;
// Set cURL options
curl_setopt($ch, CURLOPT_URL, $url2);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
@ -107,68 +108,4 @@ if (! function_exists('getheringInvoiceSubDetails')) {
}
}
?>
function generateNewToken()
{
$ch=curl_init();
$organization_id = '776847408';
$client_id = '1000.0WMDLCXAZV5DR60IKE9P49YTYGVL6C';
$refresh_token = '1000.0fcf314cc7b7b598df6e519461bbe9b8.f77688a2254137532ae33ad5e152a064';
$client_secret = '99da3a05cfa13cf91eb6476a3c44cfa3e21b6106a8';
$redirect_uri = 'https://resicoindustries.com/RIA/';
$accesstoken = '1000.095b66fc95fc81874c1cfc7d15b0904e.10bc9956d9b9ec14cce1350ee0cf8254';
$url_getauthtoken = 'https://accounts.zoho.com/oauth/v2/token?refresh_token='.$refresh_token.'&client_id='.$client_id.'&client_secret='.$client_secret.'&redirect_uri='.$redirect_uri.'&grant_type=refresh_token';
$headers=array('Authorization:Zoho-oauthtoken '.$accesstoken,'Content-Type:application/json');
curl_setopt($ch, CURLOPT_URL, $url_getauthtoken);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HEADER, 0);
$body = '{}';
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS,$body);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$res_token=curl_exec($ch);
$ress = json_decode($res_token);
return $ress->access_token;
}
function getheringInvoiceDetails($date_today , $date_yesterday , $accesstoken)
{
$ch=curl_init();
$organization_id = '776847408';
$url_org ="https://books.zoho.com/api/v3/invoices?";
$fields=array("usestate" => "true","organization_id" => $organization_id,"date_start" => $date_yesterday,"date_end" => $date_today);
$data_all = http_build_query($fields);
$headers=array('Authorization:Zoho-oauthtoken '.$accesstoken,'Content-Type:application/json');
$data_access = $url_org.$data_all;
curl_setopt($ch, CURLOPT_URL, $url_org.$data_access);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HEADER, 0);
$body = '{}';
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_POSTFIELDS,$body);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result=curl_exec($ch);
$data['headers_new'] = $headers;
$data['data'] = curl_exec($ch);
return $data;
}
function getheringInvoiceSubDetails($invoice_id , $organization_id , $headers)
{
$ch=curl_init();
$url2 = 'https://books.zoho.com/api/v3/invoices/'.$invoice_id.'?organization_id='.$organization_id;
curl_setopt($ch, CURLOPT_URL, $url2);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HEADER, 0);
$body2 = '{}';
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_POSTFIELDS,$body2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
return curl_exec($ch);
}
?>