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

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

WBOY
Release: 2016-06-23 13:56:59
Original
1085 people have browsed it

教务系统的网址:http://210.35.72.21:8888/edu/index.html (登录框在左侧)
用户名:1101002
密码:1101002s

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

先谢了!

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


回复讨论(解决方案)

header里面是不是还需要传递其他参数。
mark一下,回去我去测试一把

你确定只有用户名密码两个参数?学生,老师这个参数呢?
你要登陆一次抓包看看,可以用firebug

已经成功了,是我自己的问题,第一个登录的地址找错了,第二个参数也少提交了一个。谢谢楼上的诸位!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template