誰かがコードを調べるのを手伝ってくれませんか? 必要なデータを取得できないのはなぜですか?アドバイスをお願いします、ありがとうございます。
$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(
"ユーザー エージェント: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML、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",
"リファラー: 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_POSTFIELDS, $data);
$output =curl_exec($curl);
//ob_end_clean ();
curl_close($curl);
$result = iconv("GBK", "UTF-8//IGNORE", $output);
$score =explode(",",$result); content = "候補番号:".$Number."n"."名前:".$Name."n"."専攻:".$score."n"."スコア:".$Score[3]. "n"."件名ランキング:".$score[4];
return $content;
ディスカッションに返信 (解決策)
<?php$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);preg_match_all('/<td><div align="center">(.*)<\/div><\/td>/', $result, $match);$content = "考生号:".$match[1][0]."\n"."姓名:".$match[1][1]."\n"."专业:".$match[1][2]."\n"."成绩:".$match[1][3]."\n"."科类名次:".$match[1][4]."\n";print_r($content);
考生号:15370282131039姓名:李明珠专业:播音与主持艺术成绩:164.26 科类名次:13