注:99宿舍接口已失效
//四六级查询,方倍工作室出品 public function cet_query(){ $openid = I("post.openid"); if ($_SERVER[‘HTTP_HOST‘] != "www.fangbei.org"){ $arr = array(‘info‘ => "非法调用,请关注方倍工作室官方账号进入查询"); }else{ $name = I("post.name"); $number = I("post.number"); $name_gb2312 = urlencode(mb_convert_encoding($name, ‘gb2312‘, ‘utf-8‘)); $data = "id=".$number."&name=".$name_gb2312; $url = "https://cet.99sushe.com/getscore".$number; $headers = array( "User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20100101 Firefox/14.0.1", "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "Accept-Language: en-us,en;q=0.5", "Referer: http://cet.99sushe.com/" ); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,false); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); $output = curl_exec($curl); curl_close($curl); $result = iconv("GBK", "UTF-8//IGNORE", $output); $score = explode(",",$result); Vendor(‘Weixin.basicclass‘); $weixin = new \weixin(); if (count($score)>4){ $arr = array( ‘info‘ => "姓名:".$score[6]."\\n学校:".$score[5]."\\n总分:".$score[4] ); $data = array(); $type = substr($number,9,1); $typestr = array("1"=>"四级","2"=>"六级"); $data[] = array("title"=>"CET成绩单", "description"=>"", "picurl"=>"", "url" =>""); $data[] = array("title"=>"考生姓名:".$score[6]."\n学校名称:".$score[5], "description"=>"", "picurl"=>"", "url" =>""); $data[] = array("title"=>"考试类别:".$typestr[$type]."\n准考证号:".$number, "description"=>"", "picurl"=>$orderArr["product_img"], "url" =>""); $data[] = array("title"=>"听力部分:".$score[1]."\n阅读部分:".$score[2]."\n写作翻译:".$score[3]."\n成绩总分:".$score[4], "description"=>"", "picurl"=>($score[4] > 425)?"https://www.cnblogs.com/txw1958/ok.jpg":"https://www.cnblogs.com/txw1958/error.jpg", "url" =>""); $data[] = array("title"=>"技术支持 方倍工作室", "description"=>"", "picurl"=>"", "url" =>"https://www.cnblogs.com/txw1958/"); $result2 = $weixin->send_custom_message($openid, "news", $data); }else{ $arr = array( ‘info‘ => "姓名:".$score[6]."\\n学校:".$score[5]."\\n总分:".$score[4] ); $result2 = $weixin->send_custom_message($openid, "text", "Error\n".$name."\n".$number); } } echo json_encode($arr); }
原文地址:https://www.cnblogs.com/txw1958/p/11141554.html
时间: 2024-10-10 21:57:28