ez-captcha-client/README.md
2024-10-12 01:32:31 +01:00

57 lines
1.3 KiB
Markdown

# EzCaptcha Client Go
## Supported Captchas
- AkamaiWeb
- AkamaiBMP
- HCaptcha + Enterprise
- ReCaptchaV2 + Enterprise
- ReCaptchaV3 + Enterprise
## Installing
```sh
go get -u github.com/samjblack/ezcaptcha-client-go
```
## Usage
```go
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
```go
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)
```