');
$chsec = curl_init('https://api-secure.recaptcha.net/challenge'.$recaptha_params);
curl_setopt($chsec, CURLOPT_HEADER, 0);
curl_setopt($chsec, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($chsec, CURLOPT_HTTPHEADER, array('User-Agent: Mozilla/5.0 (Windows NT 5.1; U; zh-cn; rv:1.8.1) Gecko/20091102 Firefox/3.5.5'));
curl_setopt($chsec, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($chsec, CURLOPT_FRESH_CONNECT, 1);
curl_setopt($chsec, CURLOPT_DNS_USE_GLOBAL_CACHE, 1);
curl_setopt($chsec, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($chsec, CURLOPT_USERAGENT, 'Mozilla/5.0(Windows; U; Windows NT 6.0; en-US; rv:1.9.0.12) Gecko/2009070611 Firefox/3.0.12');
$recaptcha = curl_exec($chsec);
$responseInfo=curl_getinfo($chsec);
curl_close($chsec);
$http_code = intval($responseInfo['http_code']);
if($http_code == 0){$tResult = false;}
}
if($tResult){
$auth_key = between($signuppage, '');
$challenge = between($recaptcha, "challenge : '", "',");
echo
''.
''.
'
';
}else{
echo '
注册通讯错误
';
}
}else if($_SERVER['REQUEST_METHOD'] == 'POST'){
$ch = curl_init('https://twitter.com/account/create');
curl_setopt($ch, CURLOPT_POSTFIELDS, @file_get_contents('php://input'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0(Windows; U; Windows NT 6.0; en-US; rv:1.9.0.12) Gecko/2009070611 Firefox/3.0.12");
$rResult = curl_exec($ch);
curl_close($ch);
$result_msg = 'ok';
$err_msg = array(
'You can\'t do that right now.' => 'error',
'Please try to match the 2 words shown above' => 'match',
'has already been taken' => 'used',
'is not a valid email address' => 'email'
);
foreach($err_msg as $k => $v){
if(strpos($rResult, $k) !== false){$result_msg = $v; break;}
}
header('location: ../index.php?su='.$result_msg);
}
function between($str, $strStart, $strEnd) {
$posStart = strpos($str, $strStart);
$posEnd = strpos($str, $strEnd, $posStart);
return substr($str, $posStart + strlen($strStart), $posEnd - $posStart - strlen($strStart));
}
?>