本文整理匯總了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">»</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">»', 'class="global_pref_next">»'));
if (strpos($craw->curline, '<span class="global_pref_next_no_link">»') !== false) {
$masih = false;
} else {
$start_url = dirname($start_url.'a').'/'.$craw->getbetweenlast('<a href="', '"');
}
*/
$craw->close();
unset($craw);
示例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();
}