本文整理汇总了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();
}