1:以get方式获取内容

<?php  
$url='http://www.Rovi.tk';  
$html = file_get_contents($url);  
echo $html;  
?>

2:以post方式获取url

<?php  
$data = array ('foo' => 'bar');  

//生成url-encode后的请求字符串,将数组转换为字符串  
$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://localhost/test.php', false, $context);  
echo $html;  
?>