您的位置:首页 > 编程语言 > PHP开发

PHP使用file_get_contents函数POST数据

2016-04-06 13:15 621 查看
function http_post($url,$data = null){$cxContext = NULL;if($data!=null){
		$opts = array('http'=>array('method'=>"POST",'header'=>"Content-type: application/x-www-form-urlencoded\r\n"."Content-length:".strlen($data)."\r\n" ."\r\n",'content' => $data,));$cxContext = stream_context_create($opts);}$output = file_get_contents($url, false, $cxContext);return $output;}
                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  PHP POST file