Download the PHP package 2captcha/2captcha without Composer

On this page you can find all versions of the php package 2captcha/2captcha. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?
2captcha/2captcha
Rate from 1 - 5
Rated 5.00 based on 1 reviews

Informations about the package 2captcha

PHP Module for 2Captcha API

The easiest way to quickly integrate 2Captcha captcha solving service into your code to automate solving of any types of captcha.

Installation

This package can be installed via composer or manually

Composer

Manual

Copy src directory to your project and then require autoloader (src/autoloader.php) where needed:

Configuration

TwoCaptcha instance can be created like this:

Also there are few options that can be configured:

TwoCaptcha instance options

Option Default value Description
softId - your software ID obtained after publishing in 2captcha sofware catalog
callback - URL of your web-sever that receives the captcha recognition result. The URl should be first registered in pingback settings of your account
defaultTimeout 120 Polling timeout in seconds for all captcha types except ReCaptcha. Defines how long the module tries to get the answer from res.php API endpoint
recaptchaTimeout 600 Polling timeout for ReCaptcha in seconds. Defines how long the module tries to get the answer from res.php API endpoint
pollingInterval 10 Interval in seconds between requests to res.php API endpoint, setting values less than 5 seconds is not recommended

IMPORTANT: once callback is defined for TwoCaptcha instance, all methods return only the captcha ID and DO NOT poll the API to get the result. The result will be sent to the callback URL. To get the answer manually use getResult method

Solve captcha

When you submit any image-based captcha use can provide additional options to help 2captcha workers to solve it properly.

Captcha options

Option Default Value Description
numeric 0 Defines if captcha contains numeric or other symbols see more info in the API docs
minLength 0 minimal answer lenght
maxLength 0 maximum answer length
phrase 0 defines if the answer contains multiple words or not
caseSensitive 0 defines if the answer is case sensitive
calc 0 defines captcha requires calculation
lang - defines the captcha language, see the list of supported languages
hintImg - an image with hint shown to workers with the captcha
hintText - hint or task text shown to workers with the captcha

Below you can find basic examples for every captcha type. Check out examples directory to find more examples with all available options.

Normal Captcha

To bypass a normal captcha (distorted text on image) use the following method. This method also can be used to recognize any text on the image.

Text Captcha

This method can be used to bypass a captcha that requires to answer a question provided in clear text.

ReCaptcha v2

Use this method to solve ReCaptcha V2 and obtain a token to bypass the protection.

ReCaptcha v3

This method provides ReCaptcha V3 solver and returns a token.

FunCaptcha

FunCaptcha (Arkoselabs) solving method. Returns a token.

GeeTest

Method to solve GeeTest puzzle captcha. Returns a set of tokens as JSON.

GeeTestV4

Method to solve GeeTest V4 puzzle captcha. Returns a set of tokens as JSON.

hCaptcha

Use this method to solve hCaptcha challenge. Returns a token to bypass captcha.

KeyCaptcha

Token-based method to solve KeyCaptcha.

Capy

Token-based method to bypass Capy puzzle captcha.

Grid

Grid method is originally called Old ReCaptcha V2 method. The method can be used to bypass any type of captcha where you can apply a grid on image and need to click specific grid boxes. Returns numbers of boxes.

Canvas

Canvas method can be used when you need to draw a line around an object on image. Returns a set of points' coordinates to draw a polygon.

ClickCaptcha

ClickCaptcha method returns coordinates of points on captcha image. Can be used if you need to click on particular points on the image.

Rotate

This method can be used to solve a captcha that asks to rotate an object. Mostly used to bypass FunCaptcha. Returns the rotation angle.

Audio

This method can be used to solve a audio captcha

Yandex

Use this method to solve Yandex and obtain a token to bypass the protection.

Lemin

Use this method to solve Lemin and obtain a token to bypass the protection.

Turnstile

Use this method to solve Turnstile and obtain a token to bypass the protection.

AmazonWaf

Use this method to solve AmazonWaf and obtain a token to bypass the protection.

Other methods

send / getResult

These methods can be used for manual captcha submission and answer polling.

balance

Use this method to get your account's balance

report

Use this method to report good or bad captcha answer.

Error handling

If case of an error captch solver throws an exception. It's important to properly handle these cases. We recommend to use try catch to handle exceptions.


All versions of 2captcha with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
ext-curl Version *
ext-mbstring Version *
ext-fileinfo Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package 2captcha/2captcha contains the following files

Loading the files please wait ....