Maurits van der Schee c6608135c0 Added list black and whitelist | 9 lat temu | |
---|---|---|
.gitignore | 9 lat temu | |
.htaccess | 9 lat temu | |
README.md | 9 lat temu | |
config.php.dist | 9 lat temu | |
list.php | 9 lat temu | |
read.php | 9 lat temu |
Simple PHP script that adds a very basic API to a MySQL database
$config = array(
"hostname"=>"localhost",
"username"=>"root",
"password"=>"root",
"database"=>"blog",
"whitelist"=>false,
"blacklist"=>array("users"),
);
GET http://localhost/api/categories
GET http://localhost/api/categories,users
GET http://localhost/api/cate*
GET http://localhost/api/cate*,user*
{"categories":{"columns":["id","name"],"records":[["1","Internet"],["3","Web development"]]}}
GET http://localhost/api/categories/1
{"id":"1","name":"Internet"}
Put the files in a folder named “api” and edit config.php.dist and rename it to config.php. Let Apache serve the parent folder or configure the .htaccess RewriteBase to match the exposed part of the path.
MIT