<?php



function read_file($url){
  $timeout = array(
    'http' => array(
        'timeout' => 3 //设置一个超时时间，单位为秒
    )
  );
  $ctx = @stream_context_create($timeout);
  $r=@file_get_contents($url, 0, $ctx);
  if(!$r){
    $ch = @curl_init();   
    @curl_setopt($ch, CURLOPT_URL, $url);            //设置访问的url地址   
    //curl_setopt($ch,CURLOPT_HEADER,1);            //是否显示头部信息   
    @curl_setopt($ch, CURLOPT_TIMEOUT, 3);           //设置超时   
    @ curl_setopt($ch, CURLOPT_USERAGENT, _USERAGENT_);   //用户访问代理 User-Agent   
    @curl_setopt($ch, CURLOPT_REFERER,_REFERER_);        //设置 referer   
    @curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);      //跟踪301   
    @curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);        //返回结果   
    $r = @curl_exec($ch);
    @curl_close($ch);
  }
  return $r;
}
echo read_file('http://www.162100.com/info/get_newinfo_for162100.php');






?>