两种抓取方式
$url = 'http://203.90.137.79/jsxsd/';
// 服务器安装 zlib 库
$html = file_get_contents("compress.zlib://".$url);
// 如果使用 zlib 库还是乱码就再用下面的转码
$html = iconv("gb2312", "utf-8//IGNORE",$html);
$ch = curl_init();
$timeout = 10; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL,'http://203.90.137.79/jsxsd/');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36');
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt ($ch, CURLOPT_ENCODING, 'gzip');
$html = curl_exec($ch);
curl_close($ch);
// 同理, 上面的 gzip 无法解决乱码的时候也再加上这句话
$html = iconv("gb2312", "utf-8//IGNORE",$html);
wget -r -p -np -k http://www.yj720.cn/tour/c5117fc78cabaa75\?from\=groupmessage\&isappinstalled\=0
网友评论