當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Crawler::getbetweenlast方法代碼示例

本文整理匯總了PHP中Crawler::getbetweenlast方法的典型用法代碼示例。如果您正苦於以下問題:PHP Crawler::getbetweenlast方法的具體用法?PHP Crawler::getbetweenlast怎麽用?PHP Crawler::getbetweenlast使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Crawler的用法示例。


在下文中一共展示了Crawler::getbetweenlast方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Crawler

 $craw = new Crawler($start_url);
 //first get the pictures
 $craw->go2linewhere('class="photogallery-celeb"');
 $craw->readline();
 $line = $craw->curline;
 //echo $line;
 //echo '<br />HOI<br />';
 $ledakan = explode('<img src="', $line);
 for ($i = 1; $i < count($ledakan); $i++) {
     $imgurl = str_replace('/t/', '/', Crawler::cutuntil($ledakan[$i], '"'));
     $file = basename($imgurl);
     echo "<a href='{$imgurl}'>{$file}</a><br />\n";
 }
 //then check the next link
 $craw->go_to('class="arrow">&#187;</a>');
 $url = $craw->getbetweenlast('<a href="', '"');
 if ($url == '#') {
     $masih = false;
 } else {
     $start_url = dirname($start_url . 'a') . '/' . $url;
 }
 /*
 $craw->go2lineor(array('<span class="global_pref_next_no_link">&#187;', 'class="global_pref_next">&#187;'));
 if (strpos($craw->curline, '<span class="global_pref_next_no_link">&#187;') !== false) {
 	$masih = false;
 } else {
 	$start_url = dirname($start_url.'a').'/'.$craw->getbetweenlast('<a href="', '"');
 }
 */
 $craw->close();
 unset($craw);
開發者ID:JerryMaheswara,項目名稱:crawler,代碼行數:31,代碼來源:kapanlagi.php

示例2: Crawler

        if ($c->strpos('nodeTitle') !== false) {
            $href = $c->getbetween('<a href="', '"');
            $c2 = new Crawler($base . $href);
            $c2->go2linewhere('pageTitle');
            $title = $c2->getbetween('>', '<');
            $c2->go2linewhere('node_images');
            $ledak = explode('<a href="', $c2->curline);
            for ($i = 1; $i < count($ledak); $i++) {
                $ahref = substr($ledak[$i], 0, strpos($ledak[$i], '"'));
                echo "<a href='{$ahref}'>{$title}</a><br />\n";
            }
            //echo $c2->curline;
            $c2->close();
        } else {
            if ($c->strpos('Go to next page') !== false) {
                echo "\nADA NEXT\n";
                $url = $base . $c->getbetweenlast('</span><a href="', '"');
                break;
            } else {
                if ($c->strpos('Go to previous page') !== false) {
                    echo "\nADA PREVIOUS TANPA NEXT\n";
                    $berhenti = true;
                    break;
                }
            }
        }
    }
    $c->close();
    unset($c);
    flush();
}
開發者ID:JerryMaheswara,項目名稱:crawler,代碼行數:31,代碼來源:ezwall.php


注:本文中的Crawler::getbetweenlast方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。