PHP code example of cheukfung / zfcrawler
1. Go to this page and download the library: Download cheukfung/zfcrawler library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cheukfung / zfcrawler example snippets
Crawler\ZFCrawler;
$stu_id = '20161111111';//学号
$password = 'password';//密码
$user = ['stu_id' => $stu_id, 'stu_pwd' => $password];
/*把下面的默认信息修改为你的学校教务系统的信息即可
*不传如config参数则使用默认参数
*/
$config = array(
'link_info' => "个人信息", //个人信息链接名称
'link_score' => "成绩查询", //成绩链接名称
'link_schedule' => "学生个人课表", //课表链接名称
'link_cet' => "等级考试查询", //等级成绩链接名称
'link_exam' => "学生考试查询", //考试安排链接名称
'btn_score' => "历年成绩", //查询所有成绩的按钮名称
'btn_login' => "Button1", //登录按钮标识:id或name
'table_schedule' => '#Table1', //课表表格id
'table_score' => '#Datagrid1', //成绩表格id
'table_common' => "#DataGrid1", //普通表格id
);
$baseUri="http://210.37.0.27/";
$crawler = new ZFCrawler($user, $baseUri,$config);
try {
// $info = $crawler->getInformation(); //个人信息
// $info = $crawler->getSchedule(); //课表
$info = $crawler->getScore(); //成绩
// $info = $crawler->getCet(); //等级成绩考试
// $info = $crawler->getExam();//考试安排
echo json_encode($info);
} catch (Exception $e) {
echo $e->getCode() . $e->getMessage();
}