geetestsdk

package module
v0.0.0-...-6695dc8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2014 License: MIT Imports: 5 Imported by: 0

README

geetestsdk

Geetest SDK for Golang

使用

go get github.com/Bluek404/geetestsdk

然后在项目中import

import "github.com/Bluek404/geetestsdk"

使用key创建一个GeetestSDK实例

sdk := geetestsdk.New("3c3f7cfcdcf21e216bf4ed7930c191e2")

请把上面的3c3f7cfcdcf21e216bf4ed7930c191e2替换成你的key

然后进行验证

ok, err := sdk.Validate(challenge, validate, seccode)
if err != nil {
	log.Println(err)
}

如果oktrue则验证成功

challenge, validate, seccode是从表单获取的数据

challenge := r.FormValue("geetest_challenge")
validate := r.FormValue("geetest_validate")
seccode := r.FormValue("geetest_seccode")

表单获取数据的方法根据所使用的web框架而定

更多请查看example文件夹内示例

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GeeAPIURL = "http://api.geetest.com/validate.php"

Functions

This section is empty.

Types

type GeetestSDK

type GeetestSDK struct {
	// contains filtered or unexported fields
}

func New

func New(k string) *GeetestSDK

func (*GeetestSDK) Validate

func (g *GeetestSDK) Validate(challenge, validate, seccode string) (bool, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL