This guide provides an overview of creating a Flex client using Flex Builder and connecting it with a PHP application. The result of the walkthrough is a Flex application communicating with a PHP object exposed through WebORB for PHP.

If you are deploying on a Windows computer with IIS, make sure to grant Read/Write permissions to the IUSR_<machinename> account for the /Weborb folder.

You can verify the installation by running WebORB Management Console included with the WebORB distribution. Open localhost/[WEBORB INSTALL PATH]/index.php in a browser. When the console is loaded, you can inspect available PHP remoting services using the Management tab or run the examples included with the product.

Flex Builder Setup

Flex Application Code

WebORB for PHP product distribution contains a finished Flex application demonstrating Flex to WebORB connectivity and a remoting invocation. Copy and paste the contents of the example.mxml file located at

\Examples\SampleApp\

into the mxml file created in Flex Builder. The code in the application connects to a PHP object and retrieves some basic information about the computer where the object is running.

In order to communicate with a remote PHP object, Flex application uses the RemoteObject API to create a remoting proxy:

When an invocation response is available, Flex invokes a response handler specified in the <RemoteObject> tag. The response handler in the example, populates the text fields with the data available in the returned object:

class ComputerInfo
{
public $currentUser;
public $phpProcessId;
public $operatingSystem;
public $phpVersion;
}

Deployment

IMPORTANT: Make sure to locate the directory where Flex Builder copies the compiled client application. It is very important to place a copy
of weborb.php into the same directory. weborb.php must contain the following PHP code: