webrw

A simple read-write store for the Web Computer

A proxy tool built in PHP that supports basic web http restful api ideas like get and set. It does implement a delete, but it is an internal feature. Results are in JSON format mainly because this tool is supposed to be used programatically (sometimes to get around the same origin policy issue)

FREE LICENSE. You can use this software as you see fit just remember to give me some credit. The Author of this tool will bear no liability for any damage that results from the use of this tool.

  • PHP5 with curl library enabled
  • Download the files and extract to the desired folder on your webserver
  • Change the permission on the WORKSPACE_DIRECTORY folder (default is "doc") to allow all to read and write chmod a+rw /PATH/TO/FOLDER/doc/
  • Go to the url you just created and without entering anything, you should get "Invalid action!!!"

GET RESULT AS JSON OBJECT

http://www.webrw-site.com?get=www.google.com

GET RESULT IN RAW FORMAT

http://www.webrw-site.com?doc=www.google.com

Simple set operation

By entering the following

http://www.webrw-site.com?set=lalalalalalalala

you should get something similar to

callback("UID:e5lr859ffa6f73234ab14bcc9a2d5c1876d31fd1")

To retrieve your data you have two approaches

Raw Data

http://www.webrw-site.com/doc/UID:e5lr859ffa6f73234ab14bcc9a2d5c1876d31fd1

Returns

lalalalalalalala

As a JSON object

http://www.webrw-site.com/?get=UID:e5lr859ffa6f73234ab14bcc9a2d5c1876d31fd1

Returns

callback(["lalalalalalalala",""])

Append data value to an existing key

To append to an existing resource, simply add the "key" to the URL

http://www.webrw-site.com?set=lelelelelelelele&key=UID:e5lr859ffa6f73234ab14bcc9a2d5c1876d31fd1

Returns the same key (as expected)

callback("UID:e5lr859ffa6f73234ab14bcc9a2d5c1876d31fd1")

Now if you look at the key

http://www.webrw-site.com/doc/UID:e5lr859ffa6f73234ab14bcc9a2d5c1876d31fd1

you should get

lalalalalalalala

lelelelelelelele

  • all include statements are in class.webrw.php, so if you plan to use something other than index.php, all you have to include is class.webrw.php