I want to login university educational administration system and download the score page (login->”教务管理信息系统”->”学生所学实际成绩”). A Chinese netizen provided an account number and password.

Link: http://jwcas.cczu.edu.cn/login?locale=en

Username: 12455120

Password: 084249

Here is my code related to this problem:

Step 1 : login

logurl = "http://jwcas.cczu.edu.cn/login";
getlt = URLRead[HTTPRequest[logurl], "Body"];
lt = First@
    "name=\"lt\" value=\"" ~~ Shortest@lt__ ~~ "\" />" :> lt];
execution = 
    "name=\"execution\" value=\"" ~~ Shortest@execution__ ~~ 
      "\" />" :> execution];
eventId = 
    "name=\"_eventId\" value=\"" ~~ Shortest@eventId__ ~~ "\" />" :> 
login = HTTPRequest[
   logurl, {Method -> "POST", 
    "Headers" -> {"User-Agent" -> 
       "Mozilla/5.0 (Windows NT 6.1;rv:32.0) Gecko/20100101 \
Firefox/32.0", "Referer" -> "http://jwcas.cczu.edu.cn"}, 
    "Body" -> {"username" -> "12455120", "password" -> "084249", 
      "lt" -> ToString[lt], "execution" -> ToString[execution], 
      "_eventId" -> ToString[eventId], "submit" -> "%B5%C7%C2%BC"}}];
URLRead[login, "Body"]

By returning the results, I can make sure the login is successful.

Step 2: download score page

We need to access this link: to get the score page.

score page like this

     headers={"Accept"->"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8","Accept-Encoding"->"gzip, deflate, sdch","Accept-Language"->"zh-CN,zh;q=0.8",


    "Host"->"","Referer"->"","Upgrade-Insecure-Requests"->"1","User-Agent"->"Mozilla/5.0 (Windows NT 6.1;rv:32.0) Gecko/20100101 Firefox/32.0"};

        req = HTTPRequest[
          "", {Method -> "POST", 
           "Headers" -> headers, "ContentType" -> "text/html;charset=utf-8"(*,

Then :

URLRead[req, "Body"] 

I think mathematica will give the score page,but no results were given. how can I get the score page? Think you for your help.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.