PHP Library
The PHP client libraries wraps the raw HTTP based API of Zoho Reports with easy to use methods for the PHP platform. This enables PHP developers to easily use Zoho Reports API.
Prerequisites:
It is recommend to go through the Zoho Reports API Documentation and the Prerequisites before using the PHP client library code in your application.
Download PHP Client Library:
Download the PHP client library from the following link.
All the available APIs in the PHP Client Library can be referred in the PHP API Reference Documentation.
The below instructions helps to use Zoho Reports PHP Client Library in your PHP application.
- Download the PHP Client Library from the above download link
- Extract the ZIP file
- Copy the ReportClient.php file present in Zoho/ZohoReportPHPClient/ directory into a folder
- Point this file in your PHP code as require "ReportClient.php"
- Use the Zoho Reports APIs from your PHP code as below.
require 'ReportClient.php';
$EMAIL_ID = "yourloginemailid";
$AUTHTOKEN = "yourauthtoken";
$DB_NAME = "yourdbname";
$TABLE_NAME = "yourtablename";
$report_client_request = new ReportClient($AUTHTOKEN);
try
{
$uri = $report_client_request->getURI($EMAIL_ID, $DB_NAME, $TABLE_NAME);
// Key name should be same as table column name.
$column_values = array("Employee Name" => "Shankar", "Employee ID" => "2015", "Experience" => "5");
$response_array = $report_client_request->addRow($uri, $column_values);
}
catch (ServerException $se)
{
$error_code = $se->getErrorCode()."<br>";
$error_message = $se->getErrorMessage()."<br>";
$action = $se->getAction()."<br>";
$HTTP_statuscode = $se->getHTTPStatusCode()."<br>";
$exception_message = $se->toString();
}
catch (ParseException $pe)
{
$exception_message = $pe->getResponseContent()."<br>";
}
catch (IOException $ie)
{
$exception_message = $ie->getResponseContent()."<br>";
}