第一步注册
第二步,获取到api后将代码嵌入到相关的网页中
首先将一下代码键入到模板中,也就是表单提交页面 report.php模板中
<tr>
<td height="23">Captcha</td>
<td height="23"><?php
require_once('../../../skin/google/recaptchalib.php');
$publickey = "这里填写您申请的apikey、、、Public Key";
echo recaptcha_get_html($publickey);
?></td>
</tr>
接下来就是post到相关的页面中加代码
e/enews/index.php 在顶部加以下代码
<?php
require_once('../../skin/google/recaptchalib.php');
$privatekey = "这里写您申请的key";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
die ("Incorrect!!<a href='#' onClick='javascript :history.back(-1);'>Click here to back!</a>" .
"(reCAPTCHA said: " . $resp->error . ")");
}
最后需要下载这里的有个文件,就是上面文件中用到的recaptchalib.php
放到相关的文件目录下面就ok啦
接下来几天看下效果有没有咯。