首页 > Web开发 > 详细

PHP使用file_get_contents函数POST数据

时间:2016-04-06 15:32:42      阅读:258      评论:0      收藏:0      [点我收藏+]

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;  

}


本文出自 “流媒体服务器技术研究” 博客,请务必保留此出处http://livestreaming.blog.51cto.com/3135568/1760842

PHP使用file_get_contents函数POST数据

原文:http://livestreaming.blog.51cto.com/3135568/1760842

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!