For information on simulating post submission to obtain data, let's take a look at the code. Why can't I get the data I want? Please give me some advice. thank you.
$ Data = "bkxhtxt = 15370282131039 & sfzhtxt = % C0 % EE % C3 % F7 % D6 % E9 & Button1 = % B2 % E9 + % D1 % AF ";
$ Url = "http://lqcx.sdyu.edu.cn/2015yk/getScore.asp ";
$ Headers = array (
"User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36 SE 2.X MetaSr 1.0 ",
"Accept: text/html, application/xhtml + xml, application/xml; q = 0.9, image/webp, */*; q = 0.8 ",
"Accept-Language: zh-CN, zh; q = 0.8 ",
"Referer: http://lqcx.sdyu.edu.cn/2015yk"
);
// Ob_start ();
$ Curl = curl_init ();
Curl_setopt ($ curl, CURLOPT_URL, $ url );
Curl_setopt ($ curl, CURLOPT_RETURNTRANSFER, 1 );
// Curl_setopt ($ ch, CURLOPT_REFERER, "http://lqcx.sdyu.edu.cn/2015yk ");
Curl_setopt ($ curl, CURLOPT_HTTPHEADER, $ headers );
Curl_setopt ($ curl, CURLOPT_POST, 1 );
Curl_setopt ($ curl, CURLOPT_POSTFIELDS, $ data );
$ Output = curl_exec ($ curl );
// $ Retrievedhtml = ob_get_contents ();
// Ob_end_clean ();
Curl_close ($ curl );
$ Result = iconv ("GBK", "UTF-8 // IGNORE", $ output );
$ Score = explode (",", $ result );
$ Content = "student ID :". $ Number. "\ n ". "name :". $ Name. "\ n ". "Major :". $ score. "\ n ". "Score :". $ Score [3]. "\ n ". "category ranking :". $ score [4];
Return $ content;
Reply to discussion (solution)
(. *) <\/P> <\/td>/', $ result, $ match); $ content = "student ID :". $ match [1] [0]. "\ n ". "name :". $ match [1] [1]. "\ n ". "Major :". $ match [1] [2]. "\ n ". "Score :". $ match [1] [3]. "\ n ". "category ranking :". $ match [1] [4]. "\ n"; print_r ($ content );
Student No.: 15370282131039 name: Li Mingzhu major: Broadcasting and host artistic achievement: 164.26 subject ranking: 13
Why can't I score?