2015-04-03

php post提交数据

$data = http_build_query($data);  //整理成参数

//数据

$opts = array ( 

    'http' => array ( 

    'method' => 'POST', 

    'header'=> "Content-type: application/x-www-form-urlencoded\r\n" . 

    "Content-Length: " . strlen($data) . "\r\n", 

    'content' => $data

    ), 

);

$context = stream_context_create($opts); 

$arr_bank_data = file($postUrl,false,$context); //post提交返回的数据