Cabron Connector Logo
Another Open-Source Implementation of PHP - Flash Remoting
How does a service look like?
A Cabron Service can be a procedural PHP source file, or a PHP object.

If you choose the procedural approach, you should create a simple php file, name it as you like, and define at least one function in it.

The function should return a value: this will be transferred by the gateway to the Flash movie. The returned value can be primitive data, any kind of array, null, or CabronRecordset object.

If you choose the object-oriented approach, you should create a php source file, with a class inside that is named as the php file with the first letter capitalized. After this, you should define at least one method of the object. The returned value of the method can be primitive data, any kind of array, null, or CabronRecordset object.

Where are the services located?
The services should be placed below the directory that is specified in the gateway/gateway.php file:
You can create subfolders in this folder, and put the services there. In this case in the Flash movie you should specify the path to the service using the dot syntax. If you have a service in services/siteNameServices/service1.php, you will create the service instance in ActionScript like this:
var service = cc.getService("siteNameService.service1",this);

Working directory of the services/Includes
All the services are included in the gateway.php, so the working directory of the service is the one where the gateway is located.

If you want to include files into the services, you should do this using the $CabronServiceFolder global variable, which specifies the service folder.

function methodName(...
Configuring the gateway
There are some gateway options that can be set from the service object/file itself. These options can control:
  • the character encodings used at the deserialization/serialization process
  • the fact that the CR ("\r") characters are stripped from the result strings, or not
  • if the profile of the service execution is reported to the Flash, or not (this should be enabled form ActionScript too)
  • if the serialization is fast or safe
You can find detailed information about some of these features on the Unicode/UTF-8/Character Sets page. The method to configure the gateway is the following:
  • You define a function/method named setGatewayOptions in your service object/file.
  • This method will receive a single parameter, the called service method name. You can use this to set different options for different methods
  • You should return an associative array from this function, which can have the following keys:
array key default value
requestCharMapper ''
responseCharMapper ''
responseStripCR false
fastSerialization false
profileReport false

If you want to leave the default settings:
  • you should not define the function, or
  • you should not return a value from the function, or
  • you should not return an array or
  • you should not set a given key in the array or
  • you should set a given key in the array to null
    function setGatewayOptions($methodName){
      $opt = array();
      $opt['requestCharMapper'] = null;
      $opt['responseCharMapper'] = 'iso-8859-2-forced';
      $opt['responseStripCR'] = true;
      $opt['fastSerialization'] = true;
      //$opt['profileReport'] = true;
      return $opt;

  • (a href="">eatti)