POST流方式接受数据方法

/**
* 流方式接收数据
* @param $url
* @param $jsonFile
* @return bool
*/
private static function sendStreamJson($url, $jsonFile){

$opts = array(
'http' => array(
'method' => 'POST',
'header' => 'content-type:application/x-www-form-urlencoded',
'content' => $jsonFile,
)
);
$context = stream_context_create($opts);
$response = file_get_contents($url, false, $context);
$ret = json_decode($response, true);
return $ret;
}

posted on 2016-09-05 14:59  我很迷茫  阅读(511)  评论(0编辑  收藏  举报