现在的位置: 首页 > 综合 > 正文

file_get_contents post数据获取

2013年11月12日 ⁄ 综合 ⁄ 共 509字 ⁄ 字号 评论关闭

file_get_contents post数据获取

标签: file_get_contents post stream_context_create
$data = array ('foo' => 'bar'); 
$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); 
$html = file_get_contents('http://www.example.com', false, $context); 
  
echo $html; 

抱歉!评论已关闭.