<?
function get_contents ($url, $timeout = 5) {  
    //$re = @file_get_contents($url, false, stream_context_create(array('http'=>array( 'method'=>"GET", 'timeout'=>$timeout))));  
    //curl 抓取更快更稳定
	$ip = '220.181.109.'.rand(1,255);
	$my_curl = curl_init();    //初始化一个curl对象
	//curl_setopt($my_curl, CURLOPT_PROXYAUTH, CURLAUTH_BASIC); 
	//curl_setopt($my_curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
	//curl_setopt($my_curl, CURLOPT_PROXY, "139.199.230.242");
	//curl_setopt($my_curl, CURLOPT_PROXYPORT, "1080");
	
	curl_setopt($my_curl, CURLOPT_URL, $url);    //设置你需要抓取的URL
	curl_setopt($my_curl, CURLOPT_TIMEOUT, $timeout);  //设置超时时间
	curl_setopt($my_curl,CURLOPT_HTTPHEADER,array('X-FORWARDED-FOR:'.$ip.'','CLIENT-IP:'.$ip.''));  //伪造百度蜘蛛IP
    curl_setopt($my_curl,CURLOPT_USERAGENT,"Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)"); //伪造百度蜘蛛头部
	curl_setopt($my_curl,CURLOPT_RETURNTRANSFER,1);    //设置是将结果保存到字符串中还是输出到屏幕上，1表示将结果保存到字符串
	curl_setopt($my_curl,CURLOPT_FOLLOWLOCATION,1);    //对付301重定向的网站
	curl_setopt($my_curl, CURLOPT_ENCODING, "");       //对付压缩过的网页
	$re = curl_exec($my_curl);    //执行请求
	curl_close($my_curl);    //关闭url请求
    //curl 抓取结束
   
	if (strlen($re)<100){
		$re="出错了！";
	}
	return $re;  

} 


$url='https://'.$_GET['url'];



//$url="https://m.ydshu.com/";

$file = get_contents($url);

echo $file;

?>