I use org-etml to serve pages from within emacs and use a custom capture handler, like this:
#### (defun jeff/capture-handler (request) "Handle REQUEST objects meant for 'org-capture'. GET header should contain a path in form '/capture/KEY/LINK/TITLE/BODY'." (with-slots (process headers) request (let ((path (cdr (assoc :GET headers)))) (if (string-match "/capture:?/\\(.*\\)" path) (progn (org-protocol-capture (match-string 1 path)) (ws-response-header process 200)) (ws-send-404 process))))) (setq jeff/org-ehtml-handler '(((:GET . "/capture") . jeff/capture-handler) ((:GET . ".*") . org-ehtml-file-handler) ((:POST . ".*") . org-ehtml-edit-handler))) (when t (mapc (lambda (server) (if (= 3333 (port server)) (ws-stop server))) ws-servers) (ws-start jeff/org-ehtml-handler 3333)) #### And the relevant org-capture looks like #### ("b" "entry.html" entry (file+headline (concat org-directory "toodledo.org") "TASKS") "* TODO [#C] %:description\nSCHEDULED: %t\n%:initial\n" :immediate-finish t) #### Then, I post from a hosted form served as entry.html via org-ehtml, like this: ### <!DOCTYPE html> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <head> <title>Org Entry</title> </head> <html> <style> input[type=text] { -webkit-appearance: none; -moz-appearance: none; display: block; margin: 0; width: 100%; height: 40px; line-height: 40px; font-size: 17px; border: 1px solid #bbb; } input[type=submit],select { -webkit-appearance: none; -moz-appearance: none; display: block; margin: 0; height: 40px; line-height: 40px; font-size: 17px; border: 1px solid #bbb; } </style> <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script> <form id="target" action="/capture/b"> <input id="title" width="100%" type="text" name="title" /> <br> <select id="context" name="context"> <option value="@agendas">@agendas</option> <option value="@calls" >@calls </option> <option value="@errands">@errands</option> <option value="@home" >@home </option> <option value="@quicken">@quicken</option> <option value="@view" >@view </option> <option value="@waiting">@waiting</option> <option value="@work" >@work </option> </select> <br> <input type="submit" value="Submit" name="submit"> </form> <span></span> <script type="text/javascript"> $("#target").submit (function (event) { event.preventDefault(); var link = encodeURIComponent("LINK"); var title = encodeURIComponent($("#title").val() + " :" + $("#context").val() + ":"); var body = encodeURIComponent(""); var xurl = "/capture/b" + "/" + link + "/" + title + "/" + body; $.ajax({ url: xurl }).success(function() { $("span").text("captured "+xurl).show().fadeOut(1000); $("#title").val(""); $("#context").val("@agendas"); }).fail(function(jqXHR, textStatus) { $("span").text("failed " + xurl + "<br>" + textStatus).show(); //.fadeOut(1000); }); }); </script> </html> #### Forwarding ports from my machine running org-ehtml on emacs means I can access the page anywhere to add new tasks even from my cell phone. You could easily call this emacs-webservice from a PHP page, but it's just as easy to simply serve the page from emacs itself. Take a look at org- ehtml and the companion webserver that Schulte wrote.