Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tekintian/tekintcaptcha
腾讯验证码, 腾讯防水墙, 验证码, 滑动验证码, 智能滑动验证码PHP扩展, TekinTCaptcha - A Client library for Tencent Captcha, a service that protect websites from spam and abuse.
https://github.com/tekintian/tekintcaptcha
Last synced: about 10 hours ago
JSON representation
腾讯验证码, 腾讯防水墙, 验证码, 滑动验证码, 智能滑动验证码PHP扩展, TekinTCaptcha - A Client library for Tencent Captcha, a service that protect websites from spam and abuse.
- Host: GitHub
- URL: https://github.com/tekintian/tekintcaptcha
- Owner: tekintian
- License: other
- Created: 2018-07-06T02:51:44.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-12T09:12:19.000Z (almost 6 years ago)
- Last Synced: 2024-09-18T18:49:02.798Z (about 2 months ago)
- Language: PHP
- Size: 94.7 KB
- Stars: 18
- Watchers: 3
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TekinTCaptcha PHP client library
## 基于Google PHP项目设计思想实现的腾讯滑动智能验证码实现PHP中间件。* Project page: http://tekin.yunnan.ws/TekinTCaptcha/
* Repository: https://github.com/tekintian/TekinTCaptcha
* Version: 1.0.0## Description
腾讯验证码, 腾讯防水墙, 验证码, 滑动验证码, 智能滑动验证码PHP扩展, TekinTCaptcha - A Client library for Tencent Captcha, a service that protect websites from spam and abuse.
TekinTCaptcha is a free CAPTCHA service that protect websites from spam and abuse.This is Tencent Captcha code that provides plugins for third-party integration with TekinTCaptcha.
## Installation
### Composer (Recommended)
[Composer](https://getcomposer.org/) is a widely used dependency manager for PHP
packages. This TekinTCaptcha client is available on Packagist as
[`tekintian/tekintcaptcha`](https://packagist.org/packages/tekintian/tekintcaptcha) and can be
installed either by running the `composer require` command or adding the library
to your `composer.json`. To enable Composer for you project, refer to the
project's [Getting Started](https://getcomposer.org/doc/00-intro.md)
documentation.To add this dependency using the command, run the following from within your
project directory:
```
composer require tekintian/tekintcaptcha "~1.0"
```Alternatively, add the dependency directly to your `composer.json` file:
```json
"require": {
"tekintian/tekintcaptcha": "~1.0"
}
```### Direct download (no Composer)
If you wish to install the library manually (i.e. without Composer), then you
can use the links on the main project page to either clone the repo or download
the [ZIP file](https://github.com/tekintian/TekinTCaptcha/archive/master.zip). For
convenience, an autoloader script is provided in `src/autoload.php` which you
can require into your script instead of Composer's `vendor/autoload.php`. For
example:```php
require('/path/to/TekinTCaptcha/src/autoload.php');
$recaptcha = new \TekinTCaptcha\TekinTCaptcha($aid,$AppSecretKey);
```The classes in the project are structured according to the
[PSR-4](http://www.php-fig.org/psr/psr-4/) standard, so you may of course also
use your own autoloader or require the needed files directly in your code.## Usage
First, register keys for your site at http://007.qq.comWhen your app receives a form submission containing the `Ticket, Randstr`
field, you can verify it using:
```php
verify($Ticket, $Randstr, $UserIP);
if ($resp->isSuccess()) {
// verified!
// if Domain Name Validation turned off don't forget to check hostname field
// if($resp->getStatus() === 1) { }
} else {
$errors = $resp->getErrMsg();
}
```You can see an end-to-end working example in
[examples/index.html](examples/index.html)
[examples/login.php](examples/login.php)# thinkphp5 demo
conposer require tekintian/tekintcaptcha
```php
//腾讯验证码配置 for config.php / app.php
'tenncent_cpatcha' => [
'aid' => '123456',
'app_secret_key' => 'aaaaadfasdfdsfsdf**',
]//for login.php
public function login()
{
// 指定模板输出
return $this->fetch('login');
}
public function doLogin(){
$post = input('param.'); // 获取全部参数
if (isset($post['Ticket']) && $post['Ticket'] !='' ) {
/*从tp5的配置文件中读取aid, AppSecretKey */
$aid=config('app.tenncent_cpatcha.aid');
$AppSecretKey=config('app.tenncent_cpatcha.app_secret_key');
/*实例化 TekinTCaptcha */
$captcha = new \TekinTCaptcha\TekinTCaptcha($aid,$AppSecretKey);
/*验证票据*/
$resp = $captcha->verify($post['Ticket'], $post['Randstr']);
if ($resp->isSuccess()){
//验证成功
pp($post);//验证成功end
}else{
foreach ($resp->getErrMsg() as $msg) {
echo '' , $msg , ' ';
}
echo '返回状态码:'. $resp->getStatus() .' ';
echo '恶意等级:'. $resp->getEvilLevel() .' ';
}}
}
```# 打赏赞助 Donate
![Donate with alipay](alipay_donate.jpg "支付宝打赏赞助, Donate with Alipay")