Coder Social home page Coder Social logo

melbournite / recaptcha Goto Github PK

View Code? Open in Web Editor NEW

This project forked from google/recaptcha

0.0 1.0 0.0 594 KB

reCAPTCHA is a free service to protect your website from spam and abuse.

Home Page: http://www.google.com/recaptcha/

License: BSD 3-Clause "New" or "Revised" License

PHP 100.00%

recaptcha's Introduction

reCAPTCHA PHP client library

Build Status Latest Stable Version Total Downloads

Description

reCAPTCHA is a free CAPTCHA service that protect websites from spam and abuse. This is Google authored code that provides plugins for third-party integration with reCAPTCHA.

Installation

Use Composer to install the library. Either use composer require google/recaptcha "~1.1" or add the following to your composer.json:

    "require": {
        "google/recaptcha": "~1.1"
    }

Manual installation

If you wish to install the library manually (i.e. without Composer), an autoloader is provided as src/autoload.php. You can require it in your script instead of the usual vendor/autoload.php created by Composer. For example,

require('/path/to/recaptcha/autoload.php');

$recaptcha = new \ReCaptcha\ReCaptcha($secret);
// etc.

Usage

First, register keys for your site at https://www.google.com/recaptcha/admin

When your app receives a form submission containing the g-recaptcha-response field, you can verify it using:

<?php
$recaptcha = new \ReCaptcha\ReCaptcha($secret);
$resp = $recaptcha->verify($gRecaptchaResponse, $remoteIp);
if ($resp->isSuccess()) {
    // verified!
} else {
    $errors = $resp->getErrorCodes();
}

You can see an end-to-end working example in examples/example-captcha.php

Upgrading

From 1.0.0

The previous version of this client is still available on the 1.0.0 tag in this repo but it is purely for reference and will not receive any updates.

The major changes in 1.1.0 are:

  • installation now via Composer;
  • class loading also via Composer;
  • classes now namespaced;
  • old method call was $rc->verifyResponse($remoteIp, $response), new call is $rc->verify($response, $remoteIp)

Contributing

We accept contributions via GitHub Pull Requests, but all contributors need to be covered by the standard Google Contributor License Agreement. You can find instructions for this in CONTRIBUTING

recaptcha's People

Contributors

dseguy avatar ircmaxell avatar jakubsvestka avatar orlitzky avatar rowan-m avatar seast avatar yingliu-google avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.