天天躁日日躁狠狠躁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)載需保留來(lái)源!

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

主站蜘蛛池模板: 99精品视频在线 | a视频免费在线观看 | 成人国产在线不卡视频 | 国精产品一区二区三区有限公司 | 99热久久视频只有精品6国产 | 久久久中日AB精品综合 | 在线观看免费毛片 | 好男人在线观看视频观看高清视频免费 | 久久国产视频网 | 名女躁b久久天天躁 | 久久这里只有精品国产99 | 凌晨三点免费WWW | 色午夜日本高清视频www | 黄子佼81岁父亲现状曝光 | 阿娇和冠希13分钟在线观看 | 国产成人高清精品免费观看 | 老子午夜伦不卡电影院 | 我半夜摸妺妺的奶C了她软件 | 97在线视频免费观看97 | 亚洲综合中文字幕无线码 | 狠狠色色综合网站 | 恋夜影院支持安卓视频美女 | 麻豆国产精品AV色拍综合 | 99久久99久久久精品久久 | 成人精品视频网站 | 亚洲呦女专区 | 羞羞影院午夜男女爽爽免费 | 国产精品免费观看视频 | 玩弄朋友娇妻呻吟交换电影 | 日本综艺大尺度无删减版在线 | 国产看午夜精品理论片 | 国产精品18久久久久久欧美网址 | WRITEAS检查身体 | 麻豆精品一卡2卡三卡4卡免费观看 | 亚洲色欲国产AV精品综合 | 2020久久精品永久免费 | 暖暖视频免费高清在线观看 视频 | 久爱在线中文在观看 | 偷窥欧美wc经典tv | 国产69精品久久久久乱码韩国 | 九九在线精品视频 |