2016年5月9日

thinkphp 新浪新闻采集代码演示

摘要: index1(); } } else { //实时新闻,避免重复,数据,图片要清空,也可以保存上次的页码,留下次继续,但比较复杂,这里是清空 $this->deleteTable('think_news'); //清空表 delFile(ROOT . '/z2/Publ... 阅读全文

posted @ 2016-05-09 16:57 岩_生 阅读(710) 评论(0) 推荐(0) 编辑

php采集一网站的精美图片

摘要: (.*)(.*)/isU'; preg_match_all($preg,$file,$string); set_time_limit(0); foreach($string[2] as $key=>$value){ //echo $value; $pattern_src = '/href="(.*)">"); $img=GrabImage($str[1][0],"... 阅读全文

posted @ 2016-05-09 16:10 岩_生 阅读(326) 评论(0) 推荐(0) 编辑

百度知道的php爬虫

摘要: content , '>' , $iStart )+1 ; } function GetContent ( $url ) { $this->content = file_get_contents($url); $this->contentlen = strlen( $this->content ) ; $start = st... 阅读全文

posted @ 2016-05-09 16:07 岩_生 阅读(364) 评论(0) 推荐(0) 编辑

PHP实现简单爬虫

摘要: \'\"\ ]*).*?>/'; $result = preg_match_all($reg_tag_a, $web_content, $match_result); if ($result) { return $match_result[1]; } } /** * 修正相对路径 * * @param string $base_url * ... 阅读全文

posted @ 2016-05-09 16:07 岩_生 阅读(178) 评论(0) 推荐(0) 编辑

新浪新闻采集程序

摘要: /"; preg_match($rule,$doc,$result); echo $result; } foreach($article as &$value){ $value=OnlyUrl($value); }//提取了URL ?> /"; preg_match_all($rule,$doc,$result); ... 阅读全文

posted @ 2016-05-09 16:05 岩_生 阅读(350) 评论(0) 推荐(0) 编辑

数组金额 转 大写

摘要: /** *数字金额转换成中文大写金额的函数 *String Int $num 要转换的小写数字或小写字符串 *return 大写字母 *小数位为两位 **/ function num_to_rmb($num){ $c1 = "零壹贰叁肆伍陆柒捌玖"; $c2 = "分角元拾佰仟万拾佰仟亿"; //精确到分后面就不要了,所以只留两个小数位 ... 阅读全文

posted @ 2016-05-09 15:56 岩_生 阅读(388) 评论(0) 推荐(0) 编辑

PHP GD压缩图片

摘要: public function zip_pic(){ ini_set("memory_limit","256M"); //修改php分配的内存 $filename = './images/imgp0627.jpg'; $percent = 1; // 内容类型 header('Content-Ty... 阅读全文

posted @ 2016-05-09 15:51 岩_生 阅读(687) 评论(0) 推荐(0) 编辑

php快递查询API类-支持各种快递

摘要: expressname = $this->expressname(); } /* * 采集网页内容的方法 */ private function getcontent($url){ if(function_exists("file_get_contents")){ $file_contents = f... 阅读全文

posted @ 2016-05-09 15:44 岩_生 阅读(291) 评论(0) 推荐(0) 编辑

share一段采集程序的代码

摘要: $url, CURLOPT_HEADER => 0, CURLOPT_NOBODY => 0, CURLOPT_PORT => 80, CURLOPT_POST => 1, CURLOPT_POSTFIELDS => $postfields, CURLOPT_RETURNTRANSFER => 1, CURLOPT_FOLLOWLOCATION => 1, CU... 阅读全文

posted @ 2016-05-09 15:41 岩_生 阅读(149) 评论(0) 推荐(0) 编辑

全自动小说订阅微信推送

摘要: 'http://www.douluodalu.com.cn/jueshitangmen/6860.html', //开始采集的url 'title' => '/(.*?)/', //文章title 'time' => '/发布时间:(.*?) /', //发布时间 'content' => '/\">([\s\S]*?)/... 阅读全文

posted @ 2016-05-09 15:40 岩_生 阅读(285) 评论(0) 推荐(0) 编辑

php实现的web采集神器

摘要: /i'); //end //微调参数,通常不修改也不会影响您的正常使用 define('SLEEP_TIME', 1); define('IS_DEBUG', false); define('INSERT_DB', true); //内容的输出速度,单位:秒 define('OUTPUT_SPEED', 1); //end //需要过滤删除的文字,根据采集的网站类型进行设置,不区分大小写... 阅读全文

posted @ 2016-05-09 15:39 岩_生 阅读(312) 评论(0) 推荐(0) 编辑

自己写的一个php基于phpQuery的通用采集类

摘要: 使用演示 这是自己写的好玩的,基于它的类似于搜索引擎API吧 阅读全文

posted @ 2016-05-09 15:38 岩_生 阅读(440) 评论(0) 推荐(0) 编辑

php爬美女照

摘要: urls = $urls; if ( !empty($curlopt) ) { $this->curlopt = $curlopt; } } public function set_urls($urls) { $this->urls = $urls; return $this; ... 阅读全文

posted @ 2016-05-09 15:37 岩_生 阅读(231) 评论(0) 推荐(0) 编辑

php采集远程文章简单类

摘要: db = $db; } function geturlfile($url) { $url = trim($url); $content = ''; if (extension_loaded('curl')) { $ch = curl_init(); curl_setopt($ch,... 阅读全文

posted @ 2016-05-09 15:36 岩_生 阅读(228) 评论(0) 推荐(0) 编辑

php curl 下载图片到本地

摘要: 阅读全文

posted @ 2016-05-09 15:34 岩_生 阅读(971) 评论(0) 推荐(0) 编辑

使用 PHP cURL 提交 JSON 数据

摘要: $data = array("name" => "Hagrid", "age" => "36"); $data_string = json_encode($data); $ch = curl_init('http://api.local/rest/users'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch... 阅读全文

posted @ 2016-05-09 15:34 岩_生 阅读(369) 评论(0) 推荐(0) 编辑

php中curl类常用方法封装和详解

摘要: curl对于PHP开发这来说是经常用到的一个类. 在抓取远程文件或是内容的时候就更常用了. 不过原生态的curl类比较复杂, 尤其对于新手来说,很多参数很容易让人头晕,现在好了. 这个类是封装了几个常用的curl函数. 可以实现抓取远程文件,模拟提交数据等功能. 使用方法 阅读全文

posted @ 2016-05-09 15:33 岩_生 阅读(631) 评论(0) 推荐(0) 编辑

PHP 不支持CURL的解决方法

摘要: 方法: 1、在PHP环境安装目录下找到以下两个DLL文件:ssleay32.dll和libeay32.dll; 2、把这两个DLL拷到C:\windows\system32目录下; 3、重启IIS; 4、搞定! 其他可能会导致CURL无法加载使用的情况: php.ini 是否开启了php_curl.dll【如果没有开启,请把前面的分号去掉,重启IIS】 ... 阅读全文

posted @ 2016-05-09 15:33 岩_生 阅读(760) 评论(0) 推荐(0) 编辑

一个简单的PHP的CURL类

摘要: 我写了一个基于CURL的PHP5的类,功能比较简单,比较适合学习用。如果真要应用的话,那绝对推荐Snoopy 太强大了。虽然它不是在curl基础上的。转自 http://xiaowai.gentieba.com/node/33 使用方法 阅读全文

posted @ 2016-05-09 15:31 岩_生 阅读(754) 评论(0) 推荐(0) 编辑

PHP的curl常用的5个例子

摘要: // 1,抓取无访问控制文件 $ch= curl_init(); curl_setopt($ch, CURLOPT_URL,"http://localhost/mytest/phpinfo.php"); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURN... 阅读全文

posted @ 2016-05-09 15:30 岩_生 阅读(289) 评论(0) 推荐(0) 编辑

导航