-1
<?php
namespace App\Validators;
use GuzzleHttp\Client;
class ReCaptcha
{
    public function validate($attribute, $value, $parameters, $validator)
    {
        $client = new Client;
        $response = $client->post('https://www.google.com/recaptcha/api/siteverify',
            [
                'form_params' =>
                    [
                        'secret' => env('GOOGLE_RECAPTCHA_SECRET'),
                        'response' => $value
                    ]
            ]
        );
        $body = json_decode((string)$response->getBody());
        return $body->success;
    }
}

this code giving Error on server but working good locally

Class 'GuzzleHttp\Client' not found

iam going made of this error .. how it is working on localhost and not on server

  • Possible duplicate of [Laravel: Class 'GuzzleHttp\Client' not found](https://stackoverflow.com/questions/31227080/laravel-class-guzzlehttp-client-not-found) – d3corator Apr 08 '19 at 16:36
  • Heres a nice easy package by the way: https://github.com/anhskohbo/no-captcha – emotality Apr 08 '19 at 16:47

1 Answers1

1

first check install and exist this lib in composer.json file if don't install use this command

php composer.phar require guzzle/guzzle:~3.9

then

composer dump-autoload
Mahdi Bahari
  • 109
  • 1
  • 10