Class TwoCaptcha

java.lang.Object
com.twocaptcha.TwoCaptcha

public class TwoCaptcha extends Object
Class TwoCaptcha
  • Constructor Details

    • TwoCaptcha

      public TwoCaptcha()
      TwoCaptcha constructor
    • TwoCaptcha

      public TwoCaptcha(String apiKey)
      TwoCaptcha constructor
      Parameters:
      apiKey -
  • Method Details

    • 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
    • balance

      public double balance() throws Exception
      Gets account's balance
      Returns:
      Throws:
      Exception
    • report

      public void report(String id, boolean correct) throws Exception
      Reports if captcha was solved correctly (sends `reportbad` or `reportgood` to `/res.php`)
      Parameters:
      id -
      correct -
      Throws:
      Exception