PHP代码
- <?php
- function fileget($url){
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_URL, $url);
- curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; )');
- curl_setopt($curl, CURLOPT_HEADER, 0);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($curl, CURLOPT_COOKIE, 'domain=www.kalvin.cn');
- $tmpInfo = curl_exec($curl);
- curl_close($curl);
- return $tmpInfo;
- }
- echo fileget('http://www.kalvin.cn/');
- ?>
使用这个类的例子,远程获取网站内容,然后分析数据,得出结果,感觉很不错!

