Пример #1
0
 function getChengjiByTerm($year, $term)
 {
     if ($this->auth()) {
         $url = 'http://jw.djtu.edu.cn/academic/manager/score/studentOwnScore.do?groupId=&moduleId=2020';
         $post_fields = 'year=' . $year . '&term=' . $term . '&para=0';
         $ch = curl_init($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);
         $header[] = "Cookie:JSESSIONID={$this->sessionid}";
         curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
         $table = curl_exec($ch);
         $xuefenji = xuefenji($table);
         $array = get_td_array($table);
         $shu = count($array);
         $chengji = '<table><tr><td>课程</td><td>平时</td><td>期末</td><td>总评</td></tr>';
         for ($i = 2; $i < $shu; $i++) {
             $array2 = preg_replace("'([\r\n])[\\s]+'", "", $array[$i]);
             $chengji .= '<tr><td>【' . $array2[4] . '】</td><td>' . $array2[8] . '</td><td>' . $array2[9] . '</td><td>' . $array2[10] . '</td></tr>';
         }
         $chengji .= '</table>';
         $url = 'http://jw.djtu.edu.cn/academic/manager/score/studentOwnScore.do?groupId=&moduleId=2020';
         $post_fields = 'year=' . $year . '&term=' . $term . '&para=0&maxStatus=1';
         $ch = curl_init($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);
         $header[] = "Cookie:JSESSIONID={$this->sessionid}";
         curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
         $table = curl_exec($ch);
         $xuefenji = xuefenji($table);
         if ($chengji == "") {
             $chengji = "本学期还没有考试成绩或者您没有评教哦";
         }
         return '平均学分绩:' . $xuefenji . '<br />' . $chengji;
         curl_close($ch);
     } else {
         return $this->auth;
     }
 }
Пример #2
0
 function getChengjibyTerm($year, $term)
 {
     if ($this->auth()) {
         $cookie_file = tempnam('./', 'cookie');
         $login_url = 'http://jw.djtu.edu.cn/academic/j_acegi_security_check';
         $post_fields = 'j_username='******'&j_password='******'http://jw.djtu.edu.cn/academic/manager/score/studentOwnScore.do?groupId=&moduleId=2020';
         $post_fields = 'year=' . $year . '&term=' . $term . '&para=0';
         $ch = curl_init($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_COOKIEFILE, $cookie_file);
         $table = curl_exec($ch);
         $xuefenji = xuefenji($table);
         $array = get_td_array($table);
         $shu = count($array);
         $chengji = '';
         for ($i = 2; $i < $shu; $i++) {
             $array2 = preg_replace("'([\r\n])[\\s]+'", "", $array[$i]);
             $chengji .= '【' . $array2[4] . '】' . $array2[10] . "<br />";
         }
         $url = 'http://jw.djtu.edu.cn/academic/manager/score/studentOwnScore.do?groupId=&moduleId=2020';
         $post_fields = 'year=' . $year . '&term=' . $term . '&para=0&maxStatus=1';
         $ch = curl_init($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_COOKIEFILE, $cookie_file);
         $table = curl_exec($ch);
         $xuefenji = xuefenji($table);
         if ($chengji == "") {
             $chengji = "本学期还没有考试成绩或者您没有评教哦";
         }
         return '平均学分绩:' . $xuefenji . '<br />' . $chengji;
         curl_close($ch);
     } else {
         return "您还没有绑定,请回复“绑定教务”进入绑定教务地址";
     }
 }