i-net Clear Reports

CCPHPProxy Readme - How to run the PHP sample

Prerequisites

  • A Java VM (Java 6 or higher) is installed.
  • i-net Clear Reports is installed and running.
  • A webserver is configured and running.
  • PHP (5.x or higher) is installed and configured at the webserver.

Restrictions in using the PHP proxy

While using the PHP proxy there are some limitations that must be considered. PHP doesn't allow some characters in variable names. These characters are '.', ' ', '[' and the characters from 128 to 159. As a consequence of this the URL parameter names and the prompt names may not contain these characters either.

Installation

  • Copy the proxy script (CCPHPProxy.php) to a subdirectory in the content root of your web server.
  • Copy the “client” directory of your i-net Clear Reports installation next to the subdirectory in the content root of your web server.
  • Create your own proxy PHP file (e.g. myccproxy.php) and configure there the connection to your i-net Clear Reports server as described in the next chapter.

Usage of the proxy script

The file CCPHPProxy.php must be included into your current PHP file. It provides three functions that handle the whole preparation and connection to i-net Clear Reports.

InetHTTPProxy($url) Constructor of the proxy. Prepares the connection to the i-net Clear Reports server
Arguments:$url The URL (and context) to the i-net Clear Reports server (e.g. http://localhost:9000/) Return: Returns an object oriented handle to be used for adding more parameters and to start the connection to the i-net Clear Reports server via openCCSocket(…)
setParam($key, $value, $GET) Sets a parameter to be sent to the i-net Clear Reports server.
Arguments:$key The name of the parameter
$value The value of the parameter
$GET (optional) This option will be used internaly - but you can use it to set additional GET parameters for x-www-form-urlencoded encoded data
openCCSocket($PRINT) Sets the last necessary values for the connection to the i-net Clear Reports server, by validating and correcting the current arguments. The POST and GET arguments will be converted to be usable with i-net Clear Reports. The it builds the HTTP context, connects to the i-net Clear Reports server and returns the result to the calling client.
Arguments:$PRINT prints the result directly and handles header information Return: true, if the connection was successful, false otherwise
handleHeaders($HEADERS) Sets header information. You can manipulate the headers before you send them, but the function has to be called prior to printing the response body
Arguments:$HEADERS (optional) Array of headers to be sent Return: true, if the sending was successful, false otherwise

The following source code shows a short example of a simple access to an i-net Clear Reports service running at localhost.

<?php
// Include the proxy script
require_once("CCPHPProxy.php");
 
// Prepare the connection the the i-net Clear Reports server
CC = new InetHTTPProxy("http://localhost:9000/");
 
// Start the connection the output will directly output.
$CC->openCCSocket();
 
// Aternative
/* $CC->openCCSocket(false);
 
//handle Headers and Body:
$status = $CC->status;
$headers = $CC->resp_headers;
$body = $CC->resp_body;
 
// Do somthing
 
$CC->handleHeaders($headers);
print $body;
*/
?>

In order to test your new proxy script, open your favorite browser and enter the URL to your proxy script. You can append each parameter to the url that is possible to be used for i-net Clear Reports.

An example could be:

http://localhost/mywebsite/myccproxy.php?report=/reports/sample.rpt&init=pdf


i-net software strives to provide accurate product documentation. Please give us your feedback using the form below.
NOTE: This form is for documentation feedback only. For technical assistance, please send an email to clearreports@inetsoftware.de.

 

© Copyright 1996 - 2012, i-net software; All Rights Reserved.