2
$\begingroup$

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@
   StringCases[getlt, 
    "name=\"lt\" value=\"" ~~ Shortest@lt__ ~~ "\" />" :> lt];
execution = 
  First@StringCases[getlt, 
    "name=\"execution\" value=\"" ~~ Shortest@execution__ ~~ 
      "\" />" :> execution];
eventId = 
  First@StringCases[getlt, 
    "name=\"_eventId\" value=\"" ~~ Shortest@eventId__ ~~ "\" />" :> 
     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: http://219.230.159.132/web_cjgl/cx_cj_xh.aspx 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",

"Cache-Control"->"max-age=0","Connection"->"keep-alive","Cookie"->"ASP.NET_SessionId=4e4u1m45nstfptbnwmtzfiqu",

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

        req = HTTPRequest[
          "http://219.230.159.132/web_cjgl/cx_cj_xh.aspx", {Method -> "POST", 
           "Headers" -> headers, "ContentType" -> "text/html;charset=utf-8"(*,
           "Cookies"->cookie*)}]

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.

$\endgroup$

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.