Chinaunix首页 | 论坛 | 博客
  • 博客访问: 191114
  • 博文数量: 99
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1045
  • 用 户 组: 普通用户
  • 注册时间: 2014-07-15 14:24
文章分类
文章存档

2015年(9)

2014年(90)

我的朋友

分类: PHP

2014-11-14 14:45:17

$options = array(  
'http' => array(  
'method' => 'POST',  
                'content' => http_build_query($post),
),  
);  
$result = file_get_contents($url, false, stream_context_create($options));  
return $result;  
}  
$url = '';
$data = array('userName'=>'test',
'seed'=> md5('test'),
'startTime'=>'2014-10-23 00:00:00',
'endTime'=>date('Y-m-d H:i:s'),
'start'=>0,
'limit'=>1000);
echo file_get_contents_post($url,$data);
?>
出现了一个提示:
Notice: file_get_contents() [function.file-get-contents]: Content-type not specified assuming application/x-www-form-urlencoded in D:\htdocs\function.php on line 51
修改一下$options数组就可以了,修改如下
$options = array(  
'http' => array(  
'method' => 'POST',  
'header' => "Content-type: application/x-www-form-urlencoded ",
                'content' => http_build_query($post),
),  
);  
阅读(4941) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~