Home > Backend Development > PHP Tutorial > code collection snoopy snoop dogg charlie brown muddock

code collection snoopy snoop dogg charlie brown muddock

WBOY
Release: 2016-07-29 08:52:03
Original
1631 people have browsed it

//////////////////////php代码部分

public function snoopy()

    {
        require_once APP_PATH . 'Home/Model/Snoopy.class.php';
        //include 'Home/Model/Snoopy.class.php';   //加载Snoopy类
        $snoopy = new \Snoopy();       //实例化一个对象
        $sourceURL = "http://www.ithome.com/";    //要抓取的网页
        $snoopy->fetch($sourceURL);//获取所有内容
        $conn = $snoopy->results;
        //print_r(utf8_encode($a));
        $c 'utf-8');
        $pregContent = "/
(.*?)
/iU";
        preg_match_all($pregContent, $content, $contentArray);//匹配内容到arr数组
        $connEnd = $contentArray[1][0];
//        $kaishi="lst lst-1 new-list";
//        $jieshu="page_nav";
//        $kaishizishu =  stripos($content,$kaishi);
//        $jieshuzishu =  stripos($content,$jieshu);
//        $connEnd = substr($content,$kaishizishu+ strlen($kaishi), $jieshuzishu - ($kaishizishu + strlen($kaishi)));
        $connEnd = str_replace("
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template