用CURL来实现file_get_contents函数:curl_file_get_contents
<?php $url='http://www.bamuyu.com/news/zixun/list_7_2.html'; $content=curl_file_get_contents($url); echo $content; function curl_file_get_contents($durl){ $cookie_file = dirname(__FILE__)."/cookie.txt"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $durl); curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $r = curl_exec($ch); curl_close($ch); return $r; }
如何联系我:【我的公司】www.xinzhenkj.com(信真科技)【技术咨询】www.laohuzx.com 【QQ】3396726884
图书购买京东链接***微信小程序商城开发实战*** | ***新媒体营销精华:精准定位+爆款打造+匠心运营+内容变现***