aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 625550101e879055bff4f8f884277c754ab3d240 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
go-recaptcha
============

About
-----

This package handles reCaptcha (http://www.google.com/recaptcha) form
submissions in Go (http://golang.org/).

Usage
-----

Install the package in your environment using `go get`:

```
go get github.com/felix/go-recaptcha
```

or as part of your source if using [gb](http://getgb.io/).

To use it within your own code, import "github.com/felix/go-recaptcha" and call:

```
recaptcha.Verify(secret, response, remoteip)
```

for each reCaptcha form input you need to check, using the values obtained by
reading the form's POST parameters.

The recaptcha.Verify() function returns a Response struct defined as:

```
type Response struct {
    Success     bool     `json:"success"`
    // Errors from reCaptcha service
    ErrorCodes  []string `json:"error-codes"`
    // Our errors to caller
    Errors      []error  `json:"-"`
}
```