使用snoopy模拟登录-登录失败-多域名跳转解决方法
程序员文章站
2024-01-20 12:53:16
...
使用snoopy模拟登录-登录失败-多域名跳转
代码如下:
请大神指点一下,好像是登录失败,无法获取登录后的主界面
------解决思路----------------------
不会玩就看文档。不会玩至少应该先看看http请求数据吧?
正常登陆,看HTTP数据传输:
看清楚了吗?GET登陆的?
代码如下:
require_once("Snoopy.class.php");
$snoopy = new Snoopy;
$snoopy->agent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.122 Safari/537.36 SE 2.X MetaSr 1.0";
$snoopy->referer = "http://agent.fang.com/";
$snoopy->rawheaders["Pragma"] = "no-cache";
$snoopy->maxredirs = 2;//重定向次数
$snoopy->offsiteok = false;
$snoopy->user = "esf-agen42249";
$snoopy->pass = "dlesf2010";
$submit_url = "http://agent.fang.com/DealLoginAjax.aspx";
$submit_vars["str_username"] = "esf-agen42249";
$submit_vars["str_userpwd"] = "dlesf2010";
$submit_vars["str_imgCode"] = "请输入验证码";
$snoopy->submit($submit_url,$submit_vars);
$snoopy->setcookies();
if($snoopy->fetch("http://b.agent.fang.com/magent/HomePage.aspx")){
print_r($snoopy->headers);
print_r($snoopy->cookies);
echo("
");
// print_r($snoopy->results);//无法获取登录后才能看到的页面
}else
echo "error: ".$snoopy->error."\n";
?>
请大神指点一下,好像是登录失败,无法获取登录后的主界面
------解决思路----------------------
不会玩就看文档。不会玩至少应该先看看http请求数据吧?
正常登陆,看HTTP数据传输:
Remote Address:111.40.195.21:80
Request URL:http://agent.fang.com/DealLoginAjax.aspx?str_username=esf-agen42249&str_userpwd=571c041891354cc5b51725f0b37170f80efb4f27ba8c897e4ff67ebe17b4ce599f28ac5f7eceeb5ff2d9755c62a57db74f206d3c52ccb79b71c24e3858f29ac7d49dfb8d77192529ac387b4e9c6426ecf70f3003ce348dcd6bd4d1af84e9293164516745c654d2c9bc0089c80f02ba5f69aeaac1e142c8af8e000ac7b1a4a278&str_imgCode=%E8%AF%B7%E8%BE%93%E5%85%A5%E9%AA%8C%E8%AF%81%E7%A0%81
Request Method:GET
Status Code:200 OK
str_username=esf-agen42249&str_userpwd=571c041891354cc5b51725f0b37170f80efb4f27ba8c897e4ff67ebe17b4ce599f28ac5f7eceeb5ff2d9755c62a57db74f206d3c52ccb79b71c24e3858f29ac7d49dfb8d77192529ac387b4e9c6426ecf70f3003ce348dcd6bd4d1af84e9293164516745c654d2c9bc0089c80f02ba5f69aeaac1e142c8af8e000ac7b1a4a278&str_imgCode=%E8%AF%B7%E8%BE%93%E5%85%A5%E9%AA%8C%E8%AF%81%E7%A0%81
看清楚了吗?GET登陆的?
相关文章
相关视频