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

php空間不支持socket但支持curl時recaptcha的用法

1.修改recaptchalib.php中的兩個方法
復制代碼 代碼如下:
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);
// 我們在POST數(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
復制代碼 代碼如下:
<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申請";
$privatekey = "你的私有key ---自己去http://www.google.com/recaptcha申請";
# 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時recaptcha的用法,轉(zhuǎn)載需保留來源!

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

主站蜘蛛池模板: 少妇高潮A视频 | 一受多攻高h | 久久精品视频在线看99 | 快播性爱电影 | 久久精品九九亚洲精品天堂 | 亚洲免费在线视频观看 | 草莓西瓜樱桃香蕉直播视频 | 色戒在线完整观看在线播放版 | 成人无码国产AV免费看 | 国产97精品久久久天天A片 | 动漫美女被到爽了流 | 青青久久网 | 免费看欧美xxx片 | 一本一本之道高清在线观看 | 一个人HD高清在线观看免费视频 | 亚洲视频在线免费观看 | 午夜射精日本三级 | 背着老婆爆操性感小姨子 | 国产午夜AV无码无片久久96 | 老师你奶真大下面水真多 | 老司机午夜影院试看区 | 亚洲国产精品无码中文在线 | 亚洲一区在线视频观看 | 国产成人精选免费视频 | 国产原创剧情麻豆在线 | 免费精品国偷自产在线 | 一二三四在线高清中文版免费观看电影 | 国产精品爽爽久久久久久蜜桃网站 | 先锋影音av最新资源网 | 我不卡影院手机在线观看 | 亚洲欧美偷拍视频一区 | 国产精品免费一区二区三区四区 | 男女啪啪抽搐呻吟高潮动态图 | 啦啦啦视频在线观看WWW | 九九免费精品视频 | 欧美高清另类video | 高清无码中文字幕在线观看视频 | 久久人人玩人妻潮喷内射人人 | 国内极度色诱视频网站 | FERRCHINA内入内射 | 午夜国产精品视频 |