Contents | First Simple Example >> |
Introduction
DOAP (Dave's Own Access Protocol) is a PHP/JavaScript system to facilitate easy data exchange between a JavaScript client and a PHP server.This allows PHP functions to be in effect called remotely from JavaScript. The DOAP client will package the request and send it to the server. The DOAP server will unpack the request, process it (calling whichever function is specified with the parameters provided), package up the result and return it. The client will then unpack the results, put them into native JavaScript dynamic data types or Array objects and return them the calling script.
High-Level Framework Overview
Client (Web Browser) | Server (Web Server) | ||
User Client Script | DOAP Client | DOAP Server | User Server Script |
Initialise DOAP | |||
Build Parameters | |||
call DOAP.call() | Build URL/Request | ||
Make XMLHTTP Request | Initialise | Register Functions | |
Unpack Request | |||
Process Request | Execute Function | ||
Return Data | |||
Package Returned Data | |||
Receive Returned Data | Return Data | ||
Unpack Received Data | |||
Receive Data | Return Data |
Why use DOAP?
DOAP offers a simpler alternative than coding your own XMLHTTP request creators/handlers.
There are of course a number of frameworks and libraries allowing simplified ease of data access but DOAP cuts down the work required to interface data between JavaScript and PHP to just a few simple settings and method calls.
Requirements
For the client any JavaScript enabled browser supporting XMLHTTP will do (though asynchronous requests in DOAP don't work with IE<=6).
The server just needs to be a PHP-enabled web server.
DOAP comes bundled with xmlCreate which is required by the system to build return data (xmlCreate is also licenced under the GNU GPL v3). Please be sure to use the version of xmlCreate that ships with the specific version of DOAP you are using.
Contents | First Simple Example >> |