1.3 KiB
1.3 KiB
EzCaptcha Client Go
Supported Captchas
- AkamaiWeb
- AkamaiBMP
- HCaptcha + Enterprise
- ReCaptchaV2 + Enterprise
- ReCaptchaV3 + Enterprise
Installing
go get -u github.com/samjblack/ezcaptcha-client-go
Usage
client, err := ezcaptcha.NewClient("your-api-key", "", 0)
if err != nil {
log.Fatal(err)
}
task, err := client.NewReCaptchaV2Task(&ezcaptcha.ReCaptchaV2{
// For availabe types please refer to ezcaptcha's docs (https://ezcaptcha.atlassian.net/wiki/spaces/IS/pages/7045121/EzCaptcha+API+Docs+English)
Type: "ReCaptchaV2TaskProxyless",
WebsiteURL: "https://www.google.com/recaptcha/api2/demo",
WebsiteKey: "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",
IsInvisible: false,
})
if err != nil {
log.Fatal(err)
}
result, err := client.GetResult(task)
if err != nil {
log.Fatal(err)
}
fmt.Println(result.Solution.GRecaptchaResponse)
AkamaiBMP Example
client, err := ezcaptcha.NewClient("your-api-key", "", 0)
if err != nil {
log.Fatal(err)
}
result, err := client.SolveAkamaiBMP(&ezcaptcha.AkamaiBMP{
Type: "AkamaiBMPTaskProxyless",
BundleID: "example.bundle.id",
Device: "ios",
Version: "3.3.5",
})
if err != nil {
log.Fatal(err)
}
fmt.Println(result.Solution.Sensor)