• 技术文章 >php教程 >PHP源码

    高考成绩查询接口

    PHP中文网PHP中文网2016-05-25 17:11:00原创1405
    agent = "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5";
    	$snoopy->referer = "http://www.haedu.gov.cn/hadoe_plus/gk_cx/query.aspx" ;
    	$action = "http://www.heao.gov.cn/PZQuery/PZCJQuery.aspx";
    	$snoopy->submit($action,$frm);
    
    	$dom = str_get_html( $snoopy->results ) ;
    
    	if( count( $dom->find( 'p.result span#ErrorMSG' ) ) == 1 ){
    
    		$response->status 	=	'failed' ;
    		$response->msg 		=	$dom->find( 'p.result span#ErrorMSG', 0 )->text() ;
    		echo json_encode( $response ) ;
    
    	}else{
    
    		$tbl = $dom->find( 'p.result p.queryresult table', 0 ) ;
    		$response->status 	=	'success' ;
    		$data = array(
    				'id_card' 	=> $tbl->find( "td.common", 2)->text() ,
    				'name' 		=> $tbl->find( "td.common", 3)->text() ,
    				'yuwen' 	=> $tbl->find( "td.common", 4)->text() ,
    				'shuxue'	=> $tbl->find( "td.common", 5)->text() ,
    				'yingyu'	=> $tbl->find( "td.common", 6)->text() ,
    				'zonghe'	=> $tbl->find( "td.common", 7)->text() ,
    				'zongfen'	=> $tbl->find( "td.common", 8)->text() ,
    				'tingli' 	=> $tbl->find( "td.common", 9)->text() ,
    			);
    
    		$response->data = $data ; 
    		echo json_encode( $response ) ;
    	}


    声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。
    上一篇:php的curl封装类用法实例 下一篇:PHP检测注册用户的用户名和密码等参数
    VIP课程(WEB全栈开发)

    相关文章推荐

    • 【腾讯云】年中优惠,「专享618元」优惠券!• uploadify+PHPExcel无刷新导入数据-完善中3• 将PHP数组转成XML• 收藏PHP常用自定义函数• php微信支付接口开发程序(流程已通)• php对多维数组的某个键值排序方法
    1/1

    PHP中文网