方法一:
$url="http://www.baidu.com"; file_get_contents($url);
方法二:
// CURL 方法 $url="http://www.baidu.com"; $ch = curl_init( ); curl_setopt( $ch,CURLOPT_URL,$url ); curl_setopt( $ch,CURLOPT_HEADER,0 ); curl_setopt( $ch,CURLOPT_RETURNTRANSFER,1 ); $ret= curl_exec( $ch ); curl_close( $ch ); echo $ret;
方法三:
$url="http://www.baidu.com"; $fp=fopen($url,"r"); $response = ''; while($row = fgets($fp)) { $response.= trim($row)."\n"; }