/**
 
 * 读远程内容
 
 * @return string
 
 */
function get_url_content($url){
 
  if(function_exists("curl_init")){
 
    $ch = curl_init();
 
    $timeout = 30;
 
    curl_setopt($ch, CURLOPT_URL, $url);
 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
 
    $file_contents = curl_exec($ch);
 
    curl_close($ch);
 
  }else{
 
    $is_auf=ini_get('allow_url_fopen')?true:false;
 
    if($is_auf){
 
      $file_contents = file_get_contents($url);
 
    }
 
  }
 
  return $file_contents;
 
}

 

相关文章:

  • 2022-12-23
  • 2021-11-23
  • 2021-07-08
  • 2021-09-21
  • 2022-12-23
  • 2021-12-29
猜你喜欢
  • 2021-06-22
  • 2022-12-23
  • 2022-12-23
  • 2022-02-01
  • 2021-10-10
  • 2021-08-29
相关资源
相似解决方案