首頁 > 後端開發 > php教程 > 使用snoopy模拟登录-登录失败-多域名跳转

使用snoopy模拟登录-登录失败-多域名跳转

WBOY
發布: 2016-06-20 12:44:59
原創
881 人瀏覽過

代码如下:

<?phprequire_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("<hr/>");//	print_r($snoopy->results);//无法获取登录后才能看到的页面}else	echo "error: ".$snoopy->error."\n";?>
登入後複製


请大神指点一下,好像是登录失败,无法获取登录后的主界面


回复讨论(解决方案)

不会玩就看文档。不会玩至少应该先看看http请求数据吧?

正常登陆,看HTTP数据传输:

Remote Address:111.40.195.21:80Request 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%81Request Method:GETStatus 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登陆的?

不会玩就看文档。不会玩至少应该先看看http请求数据吧?

正常登陆,看HTTP数据传输:

Remote Address:111.40.195.21:80Request 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%81Request Method:GETStatus 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登陆的?



非常感谢╰(*´︶`*)╯怎么获取这个信息:Request URL:http://agent.******

F12审查元素,network

F12审查元素,network



登录后直接跳转了,怎么暂停查看?

晕(=_=)结贴分数怎么没发出去?怎么改?

來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板