您好,欢迎访问一九零五行业门户网

php 模仿用户登陆读取DZ 论坛验码程序-2

set_time_limit(0);
session_start();
require(config.php);
if($_server[request_method]==post)
{
 $cookie_jar2=tempnam(temp,c3);
 $cookie_jar3=tempnam(temp,c4);
 $array=array(
'answer'=>'', 
'formhash'=>$_session[hash],
'loginfield'=>'username',
'loginsubmit'=>true,
'password'=>trim($_post[password]),
'questionid'=>0,
'seccodeverify'=>trim($_post[code]),
'username'=>trim($_post[username]),
);
 $url=dz.logging.php?action=login&loginsubmit=yes;
 $ch=curl_init();
 curl_setopt($ch,curlopt_url,$url);
 curl_setopt($ch,curlopt_useragent,$_server[http_user_agent]);
 curl_setopt($ch,curlopt_post,1);
 curl_setopt($ch,curlopt_postfields,http_build_query($array));
 curl_setopt($ch,curlopt_cookiefile,$_session[cookie_jar1]);
 curl_setopt($ch,curlopt_cookiejar,$cookie_jar2);
 curl_setopt($ch,curlopt_returntransfer,1);
 curl_exec($ch);
 curl_close($ch);
 $url=dz.index.php;
 $ch=curl_init();
 curl_setopt($ch,curlopt_url,$url);
 curl_setopt($ch,curlopt_useragent,$_server[http_user_agent]);
 curl_setopt($ch,curlopt_cookiefile,$cookie_jar2);
 curl_setopt($ch,curlopt_cookiejar,$cookie_jar3);
 curl_setopt($ch,curlopt_returntransfer,1);
 $html=curl_exec($ch);
 curl_close($ch);
 preg_match(/(? 
 echo $html.
;
}
?>
html文件
header(content-type:text/html;charset=utf-8);
?>
请先配置config.php,没有验证码的请直接忽略验证码,不支持中文帐号,仅作交流使用
验证码
用户
密码
其它类似信息

推荐信息