第一步注冊
第二步,獲取到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啦
接下來幾天看下效果有沒有咯。