经测试代码如下:
/**
* 抓取URL的函数
*
* @param
* @arrange (512.笔记) jb51.cc
**/
function geturl($url)
{
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$html = curl_exec($ch);
curl_close($ch);
return $html;
}
/*** 来自编程之家 jb51.cc(jb51.cc) ***/
原文链接:https://www.f2er.com/php/528895.html