2Captcha is a captcha solving software that allows you to bypass captcha of different types. Using 2Captcha, you'll be able to bypass captcha like Google's reCAPTCHA, TikTok Captcha, FunCaptcha, or just regular text captcha.
We'll briefly go over what 2Captcha can do and a simple example website to showcase how it can bypass captcha.
What are Captchas
When you go on a website and try to submit a form, they often ask you to solve a certain challenge like filling in the words of an image or choosing the image that shows a car among a set of images.
These types of challenges are what's called a Captcha. Captchas aim to prevent bots from spamming or submitting forms multiple times. Providing random challenges only humans can solve makes it harder for bots to perform a certain action or at least decelerate their speed.
Why ByPass Captchas
Captcha challenges come in many forms. Before, Captchas mainly consisted of an image with random words or characters that are not easily readable.
Nowadays, Captchas have evolved to make it harder and harder to be solved by an automated tool.
Captchas now can be puzzles like rotating an image to its correct angle or even solving a puzzle, which is a challenge provided by KeyCAPTCHA.
All the different captchas, and the different captcha providers, made it harder for bots and automated solving tools to anticipate and solve the captchas a website might have.
Captcha challenges are not just tough for bots, but sometimes for humans too. A lot of times we can't decipher a challenge and have to click the "try again" button a couple of times.
It also can be a hindrance when it happens repeatedly. It will slow down our browsing and can be annoying when we continue to fail at the challenge. The harder the captchas are becoming to prevent bots, the harder they're becoming for humans, as well.
Why 2Captcha
How can you bypass captchas of all kinds and perform a certain action without actually solving the challenge yourself? That's where a captcha solver like 2Captcha comes in.
2Captcha provides services to solve captchas of different kinds, like Google reCAPTCHA or puzzles from KeyCAPTCHA. Regardless the type of captcha, you can use 2Captcha's services to solve that captcha.
Is 2Captcha Reliable?
2Captcha guarantees that all recaptchas can be recognized by its service. As captchas should be readable by humans, 2Captcha employs humans to help train its algorithm and system. For that reason, it's a reliable captcha solving service.
Not only is it reliable, but it also provides a very affordable plan at $0.5 for every 1000 captchas solved.
How Can You Use 2Captcha
2Captcha provides a variety of free and paid software and services to solve captchas and more.
API and SDK
In addition to its easy API, 2Captcha also has SDKs for different programming languages including PHP, Java, Go, and more. This makes its integration in your software easier, as you can easily find SDKs based on the programming language or framework you're using.
Chrome Extension
2Captcha also offers a free Chrome Extension that will automatically solve a captcha challenge you might see when viewing any page. This makes surfing the web easier and quicker!
How to Bypass Captcha
This section will create a simple website to showcase how 2Captcha can accurately solve a normal text Captcha. This website will be built with Laravel and React.
We'll go over how to use 2Captcha's PHP SDK as well, which provides easy methods to implement the integration.
Setup Server
We'll set up a Laravel server first. Run the following command in your terminal:
composer create-project laravel/laravel 2captcha-tutorial
Then, change the directory to the created website:
cd 2captcha-tutorial
Install Dependencies
Next, we'll install the dependencies we need.
We'll first install the NPM dependencies required to use React with Laravel:
npm install
npm install react react-dom
To compile our React components, add the following in webpack.mix.js
:
mix.js('resources/js/app.js', 'public/js')
.react();
Then, we'll install 2 Composer packages. We'll install 2Captcha's PHP SDK:
composer require 2captcha/2captcha
And we'll install Gregwar's CaptchaBundle to generate a captcha image that we can use to test how 2Captcha solves captchas:
composer require gregwar/captcha
Create Web Page
In this section, we'll create the main web page that will show the captcha image.
We'll create the controller that will handle the loading of the page and later the solving of the captcha challenge:
php artisan make:controller CaptchaController
Then, go to app/Http/Controllers/CaptchaController.php
and add the following function inside the class:
public function open () {
$builder = new CaptchaBuilder();
$builder->build();
$path = 'images/captcha.jpg';
$builder->save(\public_path($path));
return view('welcome', ['captchaImage' => $path]);
}
This will generate a captcha image and place it in public/images
, then will send the path of the image to the view.
Next, change the route handler for the /
route. Go to routes/web.php
and change the route currently present:
Route::get('/', [CaptchaController::class, 'open']);
Now, we'll modify the view of the homepage. Go to resources/views/welcome.blade.php
and add the Bootstrap CDN in the <head>
to provide styling:
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We" crossorigin="anonymous">
Then, change the <body>
to the following:
<body class="container mt-5">
<script>
window.captchaImage = "{{ $captchaImage }}";
</script>
<div id="root"></div>
<script src="/js/app.js"></script>
</body>
This will add the image path we sent from the controller to the window
object so we can use it later in the React component and adds a <div>
if ID root
which is where we'll render the React component. Finally, we're placing the Javascript file /js/app.js
at the end of the body.
Create React Component
Now, we'll create the React component that will show the Captcha image, and when the button Get Value is clicked will get the value from the server.
Create the file resources/js/CaptchaSolver.js
with the following content:
import { useState } from 'react';
function CaptchaSolver () {
const [captchaValue, setCaptchaValue] = useState(null)
function getCaptchaValue(e) {
e.target.disabled = true;
window.axios.post('/api/solve', {image: window.captchaImage})
.then((response) => {
setCaptchaValue(response.data.value);
e.target.disabled = false;
})
.catch((err) => console.error(err))
}
return (
<div className="d-flex flex-column justify-content-center align-items-center">
<img src={window.captchaImage} className="img-fluid mb-4" />
<button className="btn btn-primary" onClick={getCaptchaValue}>Get Value</button>
{captchaValue && <span className="text-danger">Value: {captchaValue}</span>}
</div>
)
}
export default CaptchaSolver;
As you can see we're sending a POST request to an API endpoint which we'll create soon.
Finally, change the content of resources/app.js
to render the React component inside the #root
element:
import ReactDOM from 'react-dom';
import Captcha from './CaptchaSolver';
require('./bootstrap');
ReactDOM.render(<Captcha />, document.getElementById('root'));
Adding the Endpoint
Now, we'll add the endpoint. Here, we'll use 2Captcha's PHP SDK we created earlier.
First, create a function inside CaptchaController
that will handle the request:
public function solve (Request $request) {
}
Then, inside the function, initialize the SDK with the API Key of your account which you can find in the account settings:
$solver = new TwoCaptcha('API_KEY');
The SDK offers easy-to-use methods to solve the captcha. As we are just solving a captcha image, we'll use the normal method:
$result = $solver->normal(\public_path($request->get('image')));
Finally, we'll return a JSON response with the value received from 2Captcha:
return response()->json(['success' => true, 'value' => $result->code]);
We just need to add the new API route. Add the following in routes/api.php
:
Route::post('/solve', [CaptchaController::class, 'solve']);
Solving Captcha
Let's test everything out. First, start the server if it's not already started:
php artisan serve
Then, run watch
command with NPM to compile React's changes:
npm run watch
Go to localhost:8000
(if that's the port it's running on). You'll see a Captcha image with a button.
Click on the button. A request will be sent to the endpoint and once the response is received, you'll see that 2Captcha solved the captcha challenge correctly.
Conclusion
2Captcha is an easy-to-use solver that solves Recaptcha and captchas of all kinds. Using this captcha solving software, it facilitates surfing websites that requires the user to solve the captcha challenge and prove they're human. It also prevents Bot detection.
Make sure to sign up with 2Captcha now. You can also check out their FAQ page for more info.