摘要: 新闻信息采集<?phpfunction canshujiequ($yuanma,$canshustr,$mubiao){ if($yuanma=='')return array(); if(strpos($canshustr,'[参数]')==false||strpos($mubiao,'[参数1]')==false) { echo '参数或组合字符串格式不对'; return array(); } $... 阅读全文
posted @ 2013-03-09 10:32 芭菲雨 阅读(571) 评论(0) 推荐(0) 编辑
摘要: 因为图片是相对路径,我们要把相对路径替换成绝对路径。<?php$contents=file_get_contents($url); $contents=str_replace("/EditManager/File/News/","http://news.ef360.com/EditManager/File/News/",iconv("GBK", "UTF-8//IGNORE", $contents));?> 阅读全文
posted @ 2013-03-09 09:55 芭菲雨 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 图片的来源链接,以时间time()命名<?phpfunction GrabImage($url, $filename=""){ //$url 为空则返回 false; if($url == ""){return false;} $ext = strrchr($url, ".");//得到图片的扩展名 if($ext != ".gif" && $ext != ".jpg" && $ext != ".bmp"){echo "格式不支 阅读全文
posted @ 2013-03-09 09:33 芭菲雨 阅读(464) 评论(0) 推荐(0) 编辑
摘要: 现在总结有两个原因:1.编码问题。解决:<?php$url = "http://news.ef360.com/Articles/2013-3-8/299954.html"; $contents=file_get_contents($url); $contents=iconv("GBK", "UTF-8//IGNORE", $contents);echo $contents;?> 2.目标页面开了Gzip解决:@curl获取时<?phpfunction curl_get($url, $gzip=false){ $cur 阅读全文
posted @ 2013-03-09 09:11 芭菲雨 阅读(187) 评论(0) 推荐(0) 编辑