View source with formatted comments or as raw
    1:- module(test_recaptcha,
    2	  [
    3	  ]).    4:- use_module(library(http/http_dispatch)).    5:- use_module(library(http/http_parameters)).    6:- use_module(library(http/html_write)).    7:- use_module(library(http/recaptcha)).    8
    9:- http_handler(root(test/recaptcha), captcha_form,     []).   10:- http_handler(root(test/callback),  captcha_callback, []).   11
   12captcha_form(_Request) :-
   13	reply_html_page(
   14	    plain,
   15	    title('Captcha test'),
   16	    \form).
   17
   18form -->
   19	{ http_link_to_id(captcha_callback, [], HREF)
   20	},
   21	html(h1('Test page for recaptcha configuration')),
   22	html(form([method('POST'), action(HREF)],
   23		  [ \recaptcha([]),
   24		    input([name(name)]),
   25		    input(type(submit))
   26		  ])).
   27
   28captcha_callback(Request) :-
   29	recaptcha_parameters(RecapthaParams),
   30	http_parameters(Request,
   31			RecapthaParams,
   32			[form_data(Form)]),
   33	format('Content-type: text/plain\n\n'),
   34	print_term(Form, [output(current_output)]),
   35	(   recaptcha_verify(Request, RecapthaParams)
   36	->  format('Welcome human!~n')
   37	;   format('Go away, alien!~n')
   38	)