Code代码片断(5do8)

PHPMysqlApacheLinux

新主题
php escape URL 编码
php中文字符串截取函数
file_get_contents post数...
获取文本内容
php文件写入
检查url网址是否存在
php输出系统状态函数
获取网页中标签之间的数据...
php中的模板替换常用方法
说话自由

首页 » LAMP » PHP »

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; 

ccdot写于2008-8-21 16:37:49

如果愿意,请留下你观点或者感受...
称呼*
内容*
验证码*