PHP code example of yaohua / geetet
1. Go to this page and download the library: Download yaohua/geetet library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
yaohua / geetet example snippets
namespace demo
{
public partial class GetCaptcha : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.ContentType = "application/json";
Response.Write(getCaptcha());
Response.End();
}
private String getCaptcha()
{
GeetestLib geetest = new GeetestLib(GeetestConfig.publicKey, GeetestConfig.privateKey);
String userID = "test";
Byte gtServerStatus = geetest.preProcess(userID,"web","127.0.0.1");
Session[GeetestLib.gtServerStatusSessionKey] = gtServerStatus;
Session["userID"] = userID;
return geetest.getResponseStr();
}
}
}