Home  >  Article  >  Backend Development  >  想 模拟登录 自己学校的教务系统,失败了,请问大神

想 模拟登录 自己学校的教务系统,失败了,请问大神

WBOY
WBOYOriginal
2016-06-13 11:57:181033browse

想 模拟登录 自己学校的教务系统,失败了,请教大神
教务系统的网址:http://210.35.72.21:8888/edu/index.html (登录框在左侧)
用户名:1101002
密码:1101002s

最近在练习模拟登陆,于是我自己写了段模拟登陆教务系统,想试一下,但是一直不能登陆成功。所以想请教一下大神,问题出在哪里呢?

先谢了!

<br /><head><br /><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><br /></head><br /><br /><body><br /><br /><?php  <br /><br />$cookie_file = tempnam('./temp','cookie');<br />$login_url = 'http://210.35.72.21:8888/edu/student/login.do?messageflag=true';<br />$post_fields  = 'username=1101002&password=1101002s';<br /><br />//登录并获取cookie<br />$ch = curl_init($login_url);<br />curl_setopt($ch, CURLOPT_HEADER, 0);<br />curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br />curl_setopt($ch, CURLOPT_POST, 1);<br />curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);<br />curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);<br />echo $text = curl_exec($ch);<br />curl_close($ch);<br /><br />echo '<hr/>';<br /><br />//利用cookie加载一个页面<br />$url = 'http://210.35.72.21:8888/edu/student/historySchedule.do';<br />$ch = curl_init($url);<br />curl_setopt($ch, CURLOPT_HEADER, 0);<br />curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br />curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);<br />echo $text = curl_exec($ch);<br />curl_close($ch);<br /><br />?><br /><br /></body><br />

------解决方案--------------------
header里面是不是还需要传递其他参数。
mark一下,回去我去测试一把
------解决方案--------------------
1、登录“选课中心”主页,输入学号和密码,点击顶端“选课退课”菜单。 
显然你没有登录
------解决方案--------------------
你确定只有用户名密码两个参数?学生,老师这个参数呢?
你要登陆一次抓包看看,可以用firebug

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn