天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

php空間不支持socket但支持curl時(shí)recaptcha的用法

1.修改recaptchalib.php中的兩個(gè)方法
復(fù)制代碼 代碼如下:
function _recaptcha_http_post($host, $path, $data, $port = 80) {
$req = _recaptcha_qsencode ($data);
$response = '';
$url = $host.$path;
$post_data = $req;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// 我們?cè)赑OST數(shù)據(jù)哦!
curl_setopt($ch, CURLOPT_POST, 1);
// 把post的變量加上
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$output = curl_exec($ch);
curl_close($ch);
//echo $output;
$response = $output;
return $response;
}
function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array())
{
if ($privkey == null || $privkey == '') {
die ("To use reCAPTCHA you must get an API key from <a );
}
if ($remoteip == null || $remoteip == '') {
die ("For security reasons, you must pass the remote ip to reCAPTCHA");
}
//discard spam submissions
if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) {
$recaptcha_response = new ReCaptchaResponse();
$recaptcha_response->is_valid = false;
$recaptcha_response->error = 'incorrect-captcha-sol';
return $recaptcha_response;
}
$response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
array (
'privatekey' => $privkey,
'remoteip' => $remoteip,
'challenge' => $challenge,
'response' => $response
) + $extra_params
);
$answers = explode ("/n", $response [1]);
$recaptcha_response = new ReCaptchaResponse();
$pos = strpos($response, 'true');
if ($pos === false) {
$recaptcha_response->is_valid = false;
$recaptcha_response->error = $response;
} else {
$recaptcha_response->is_valid = true;
}
return $recaptcha_response;
}

2.demo.php
復(fù)制代碼 代碼如下:
<html>
<body>
<form action="" method="post">
<?php
require_once('recaptchalib.php');
// Get a key from https://www.google.com/recaptcha/admin/create
$publickey = "你的公共key ---自己去http://www.google.com/recaptcha申請(qǐng)";
$privatekey = "你的私有key ---自己去http://www.google.com/recaptcha申請(qǐng)";
# the response from reCAPTCHA
$resp = null;
# the error code from reCAPTCHA, if any
$error = null;
# was there a reCAPTCHA response?
if ($_POST["recaptcha_response_field"]) {
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($resp->is_valid) {
echo "You got it!";
} else {
# set the error code so that we can display it
$error = $resp->error;
echo $error;
//echo $_POST["recaptcha_challenge_field"];
//echo $_POST["recaptcha_response_field"];
}
}
echo recaptcha_get_html($publickey, $error);
?>
<br/>
<input type="submit" value="submit" />
</form>
</body>
</html>

php技術(shù)php空間不支持socket但支持curl時(shí)recaptcha的用法,轉(zhuǎn)載需保留來源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 高傲教师麻麻被同学调教123 | 亚洲国产区中文在线观看 | 亚洲成人在线免费 | 拔擦拔擦8X永久华人免费播放器 | 无人区尖叫之夜美女姐姐视频 | 欧洲精品一区二区不卡观看 | 99国产在线视频有精品视频 | 手机在线亚洲日韩国产 | 波野结衣qvod | 麻豆国产人妻精品无码AV | 三级黄色小视频 | 中文字幕高清在线观看 | 日本xxxxxxx| 在线观看国产亚洲 | 亚洲成片在线看 | 年轻的搜子8中字在线观看 年轻的朋友4在线看中文字幕 | 久久婷婷五月综合色丁香花 | 中文无码第3页不卡av | 九九热国产视频 | 国产精品毛片AV久久97 | 欧美最猛黑人XXXXWWW | 国产精品成人在线播放 | 97国产蝌蚪视频在线观看 | 国产AV电影区二区三区曰曰骚网 | 24小时日本免费看 | 国产自产视频在线观看香蕉 | 亚洲精品无码午夜福利在线观看 | 樱花草在线观看影院 | 亚洲专区区免费 | 成人在免费视频手机观看网站 | 嫩草国产福利视频一区二区 | 日韩欧美国产免费看清风阁 | 精品区2区3区4区产品乱码9 | 补课H湿 1V1 PLAY | 色戒未删减版在线观看完整 | 久久这里只有精品国产精品99 | 亚洲精品无AMM毛片 亚洲精品网址 | 久久亚洲国产成人影院 | 精品久久久久久久高清 | 清冷受被CAO的合不拢 | 亚洲精品无码AAAAAA片 |