This is an old revision of the document!
The ADOdb Proxy server provides a simple method of extending a database connection to provide a simple REST server via http. It provides a limited number of ADOdb commands that can be executed across an http channel against any supported database.
Modify the server.php as required to provide a database connection
/* * Define the IP address you want to accept requests from * as a security measure. If blank we accept anyone */ $ACCEPTIP = '192.168.0.65'; /* * Connection parameters */ $driver = 'mysqli'; $host = 'localhost'; $uid = 'proxy'; $pwd = 'proxy'; $database = 'employees';
Configuration of the client side differs only slightly from the normal ADOdb configuration.
include '../adodb-master/adodb.inc.php'; /* * We must manually include the driver that is used on the server side. This is * so that database specific objects can be correctly interpreted on the client * side */ include '../adodb-master/drivers/adodb-mysqli.inc.php'; $db = ADOnewConnection('proxy'); /* * Connection honors $ADODB_FETCH_MODE, but not $db->setFetchMode(); */ $ADODB_FETCH_MODE = ADODB_FETCH_NUM; /* * define a connection directly to the server program */ $url = 'http://192.168.1.109/adodb-master/server.php'; /* * Create a connection */ $db->connect($url); /* * Create an SQL command */ $sql = "SELECT * FROM employees"; /* * Execute and treat exactly the same as a normal ADOdb result set */ $result = $db->selectLimit($sql,1,10); while ($r = $result->fetchRow()) print_r($r);