Package com.twocaptcha
Class TwoCaptcha
- java.lang.Object
-
- com.twocaptcha.TwoCaptcha
-
public class TwoCaptcha extends Object
Class TwoCaptcha
-
-
Constructor Summary
Constructors Constructor Description TwoCaptcha()TwoCaptcha constructorTwoCaptcha(String apiKey)TwoCaptcha constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublebalance()Gets account's balanceStringgetResult(String id)Returns result of captcha if it was solved or `null`, if result is not readyvoidreport(String id, boolean correct)Reports if captcha was solved correctly (sends `reportbad` or `reportgood` to `/res.php`)Stringsend(Captcha captcha)Sends captcha to '/in.php', and returns its `id`voidsetApiKey(String apiKey)voidsetCallback(String callback)voidsetDefaultTimeout(int timeout)voidsetHost(String domain)voidsetHttpClient(ApiClient apiClient)voidsetPollingInterval(int interval)voidsetRecaptchaTimeout(int timeout)voidsetSoftId(int softId)voidsolve(Captcha captcha)Sends captcha to `/in.php` and waits for it's result.voidsolve(Captcha captcha, Map<String,Integer> waitOptions)Sends captcha to `/in.php` and waits for it's result.voidwaitForResult(Captcha captcha, Map<String,Integer> waitOptions)This helper waits for captcha result, and when result is ready, returns it
-
-
-
Constructor Detail
-
TwoCaptcha
public TwoCaptcha()
TwoCaptcha constructor
-
TwoCaptcha
public TwoCaptcha(String apiKey)
TwoCaptcha constructor- Parameters:
apiKey-
-
-
Method Detail
-
setApiKey
public void setApiKey(String apiKey)
- Parameters:
apiKey-
-
setHost
public void setHost(String domain)
- Parameters:
domain-
-
setSoftId
public void setSoftId(int softId)
- Parameters:
softId-
-
setCallback
public void setCallback(String callback)
- Parameters:
callback-
-
setDefaultTimeout
public void setDefaultTimeout(int timeout)
- Parameters:
timeout-
-
setRecaptchaTimeout
public void setRecaptchaTimeout(int timeout)
- Parameters:
timeout-
-
setPollingInterval
public void setPollingInterval(int interval)
- Parameters:
interval-
-
setHttpClient
public void setHttpClient(ApiClient apiClient)
- Parameters:
apiClient-
-
solve
public void solve(Captcha captcha) throws Exception
Sends captcha to `/in.php` and waits for it's result. This helper can be used instead of manual using of `send` and `getResult` functions.- Parameters:
captcha-- Throws:
Exception
-
solve
public void solve(Captcha captcha, Map<String,Integer> waitOptions) throws Exception
Sends captcha to `/in.php` and waits for it's result. This helper can be used instead of manual using of `send` and `getResult` functions.- Parameters:
captcha-waitOptions-- Throws:
Exception
-
waitForResult
public void waitForResult(Captcha captcha, Map<String,Integer> waitOptions) throws Exception
This helper waits for captcha result, and when result is ready, returns it- Parameters:
captcha-waitOptions-- Throws:
Exception
-
send
public String send(Captcha captcha) throws Exception
Sends captcha to '/in.php', and returns its `id`- Parameters:
captcha-- Returns:
- Throws:
Exception
-
getResult
public String getResult(String id) throws Exception
Returns result of captcha if it was solved or `null`, if result is not ready- Parameters:
id-- Returns:
- Throws:
Exception
-
-