当前位置: 首页>>代码示例>>PHP>>正文


PHP Crawler::cutfromlast方法代码示例

本文整理汇总了PHP中Crawler::cutfromlast方法的典型用法代码示例。如果您正苦于以下问题:PHP Crawler::cutfromlast方法的具体用法?PHP Crawler::cutfromlast怎么用?PHP Crawler::cutfromlast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Crawler的用法示例。


在下文中一共展示了Crawler::cutfromlast方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: imagefap_realm

function imagefap_realm($base)
{
    //http://www.imagefap.com/pictures/2525382/Highly-Erotic-Nude-Models-HQ-Picture
    $sitename = "http://www.imagefap.com";
    $finish = false;
    $firstbase = $base;
    $dir = urldecode(basename($base));
    $i = 1;
    while (!$finish) {
        $c = new Crawler($base);
        echo $base . "<br/>";
        $c->go_to(array('<table style=', ':: next ::'));
        if (Crawler::is_there($c->curline, ':: next ::')) {
            $finish = false;
            $urld = Crawler::extract($c->curline, 'href="', '"');
            $base = $firstbase . html_entity_decode($urld);
            $c->go_to('<table style=');
        } else {
            $finish = true;
        }
        while ($line = $c->readline()) {
            if (Crawler::is_there($line, 'border=0')) {
                $img = Crawler::extract($line, 'src="', '"');
                $img = str_replace('/thumb/', '/full/', $img);
                $img = preg_replace('/\\/x\\d\\./', '/', $img);
                $filename = basename($img);
                $ext = Crawler::cutfromlast($filename, '.');
                $text = Crawler::n($i++, 4);
                echo "<a href='{$img}'>{$dir}</a><br/>\n";
            } else {
                if (Crawler::is_there($line, '</form>')) {
                    break;
                }
            }
        }
        $c->close();
    }
}
开发者ID:JerryMaheswara,项目名称:crawler,代码行数:38,代码来源:h.php

示例2: download_all

 private function download_all($base, $destination)
 {
     $sitename = "http://www.imagefap.com";
     $finish = false;
     $firstbase = $base;
     $i = 1;
     while (!$finish) {
         $c = new Crawler($base);
         echo $base . "\n";
         $c->go_to(array('<table style=', ':: next ::'));
         if (Crawler::is_there($c->curline, ':: next ::')) {
             $finish = false;
             $urld = Crawler::extract($c->curline, 'href="', '"');
             $base = $firstbase . html_entity_decode($urld);
             $c->go_to('<table style=');
         } else {
             $finish = true;
         }
         while ($line = $c->readline()) {
             if (Crawler::is_there($line, 'border=0')) {
                 $img = Crawler::extract($line, 'src="', '"');
                 $img = str_replace('/thumb/', '/full/', $img);
                 $img = preg_replace('/\\/x\\d\\./', '/', $img);
                 $filename = basename($img);
                 $ext = Crawler::cutfromlast($filename, '.');
                 $text = Crawler::n($i++, 4);
                 $this->save_to($img, "{$destination}/{$text}{$ext}");
             } else {
                 if (Crawler::is_there($line, '</form>')) {
                     break;
                 }
             }
         }
         $c->close();
     }
 }
开发者ID:JerryMaheswara,项目名称:crawler,代码行数:36,代码来源:Imagefap_Downloader.php

示例3: crawl_1_page

function crawl_1_page($start_url)
{
    global $prefix;
    global $bas;
    $cr = new Crawler($start_url);
    /*
    	echo $cr->readline();flush();
    while(!feof($cr->stream)) {
    }
    exit(0);
    */
    $cr->go2linewhere('headerSelect');
    $cr->readline();
    $line = $cr->curline;
    $cr->close();
    $chap = Crawler::cutfromlast1($start_url, '/');
    if (strpos($chap, '.') === false) {
        $chap = Crawler::n($chap, 3);
    } else {
        $a = explode('.', $chap);
        $a[0] = Crawler::n($a[0], 3);
        $chap = implode('.', $a);
    }
    $pi = 1;
    // page i
    $ledak = explode('value="', $line);
    $pages = array();
    for ($i = 1; $i < count($ledak); $i++) {
        $uurl = Crawler::cutuntil($ledak[$i], '"');
        $key = Crawler::cutfromlast1($uurl, '/');
        $pages[$key] = strpos($uurl, 'http://') === 0 ? $uurl : $bas . $uurl;
    }
    //print_r($pages);flush();
    $results = array();
    foreach ($pages as $pagenum => $new_url) {
        $berhasil = false;
        while (!$berhasil) {
            $cr = new Crawler($new_url);
            //echo "URL:$new_url<br/>\n";flush();
            $cr->go2linewhere('id="readerPage"');
            if ($cr->strpos('<img src="') === false) {
                $cr->readline();
            }
            $line = $cr->curline;
            $cr->close();
            $img_url = Crawler::extract($line, '<img src="', '"');
            //echo "IMG:$img_url<br/>\n";flush();
            $real_name = basename($img_url);
            $ext = Crawler::cutfromlast($img_url, '.');
            //$filename = $prefix . '-' . $chap . '-' . Crawler::n($pagenum, 2) . $ext;
            $filename = $prefix . '-' . $chap . '-' . urldecode($real_name);
            $val = $img_url;
            if (!empty($val)) {
                $berhasil = true;
                $key = $filename;
                $results[$filename] = $img_url;
                ?>
				<a href="<?php 
                echo $val;
                ?>
"><?php 
                echo $key;
                ?>
</a><br />
				<?php 
                flush();
            } else {
            }
        }
    }
}
开发者ID:JerryMaheswara,项目名称:crawler,代码行数:71,代码来源:mangatoshokan.php

示例4: parse_url

 public static function parse_url($url, $component = -1)
 {
     $hasil = parse_url($url, $component);
     $hasil['filename'] = basename($hasil['path']);
     $hasil['extension'] = Crawler::cutfromlast($hasil['filename'], '.');
     $hasil['filename_noext'] = Crawler::cutuntillast($hasil['filename'], '.');
     return $hasil;
 }
开发者ID:JerryMaheswara,项目名称:crawler,代码行数:8,代码来源:crawler.php


注:本文中的Crawler::cutfromlast方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。