url post提交

<?php 

	$data = array(
		'service'	=> 'App.Sysmewenzhen.WdYuYueInfo',
		'token'		=> isset($_GET['token'])?$_GET['token']:'',
		'yy_token'	=> isset($_GET['yy_token'])?$_GET['yy_token']:'',
	);  //定义参数  
    $data = @http_build_query($data);  //把参数转换成URL数据  
    $aContext = array(
        'http' => array(
            'method' => 'POST',  
            'header'  => 'Content-type: application/x-www-form-urlencoded',  
            'content' => $data
         )
    );  
    $cxContext  = stream_context_create($aContext);  
    $sUrl = $GLOBALS['jkym']; //此处必须为完整路径  
    $url = @file_get_contents($sUrl,false,$cxContext);
    $info = json_decode($url, true);
    if ( $info['data']['code'] == 'succ' ) {
    	$canshu = $info['data'][0];
    	if ( $canshu['zf_status'] != '0'  ) {
    		header("Location: http://www.baidu.com);
    		exit;
    	}
    }
    // echo '<pre>';
    // var_dump($canshu);
?>

猜你喜欢

转载自blog.csdn.net/Bel_Ami_n/article/details/82871029
今日推荐