access_token; } } if (! function_exists('getheringInvoiceDetails')) { function getheringInvoiceDetails($date_today, $date_yesterday, $accesstoken) { // Initialize cURL $ch = curl_init(); // Zoho API credentials $organization_id = '776847408'; $url_org = "https://books.zoho.com/api/v3/invoices?"; // $url_org = "https://zohoapis.com/books/v3/invoices?"; // Construct query parameters $fields = array( "usestate" => "true", "organization_id" => $organization_id, "date_start" => $date_yesterday, "date_end" => $date_today ); $data_all = http_build_query($fields); // Set headers $headers = array( 'Authorization: Zoho-oauthtoken '.$accesstoken, 'Content-Type: application/json' ); // Construct URL $data_access = $url_org.$data_all; // Set cURL options curl_setopt($ch, CURLOPT_URL, $data_access); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Execute cURL request $result = curl_exec($ch); // Store headers and data $data['headers_new'] = $headers; $data['data'] = curl_exec($ch); // Return data return $data; } } if (! function_exists('getheringInvoiceSubDetails')) { function getheringInvoiceSubDetails($invoice_id, $organization_id, $headers) { // Initialize cURL $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://zohoapis.com/api/v3/invoices/'.$invoice_id.'?organization_id='.$organization_id; // $url2 = 'https://zohoapis.com/books/v3/invoices/'.$invoice_id.'?organization_id='.$organization_id; // Set cURL options curl_setopt($ch, CURLOPT_URL, $url2); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Execute cURL request and return response return curl_exec($ch); } } if (! function_exists('test_helper')) { function test_helper() { return "Helper function called!"; } } ?>