本文整理匯總了PHP中Crawler::getalllineswhere方法的典型用法代碼示例。如果您正苦於以下問題:PHP Crawler::getalllineswhere方法的具體用法?PHP Crawler::getalllineswhere怎麽用?PHP Crawler::getalllineswhere使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Crawler
的用法示例。
在下文中一共展示了Crawler::getalllineswhere方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: unset
$lines = $c->getalllineswhere('>>');
$c->close();
unset($c);
//echo '$lines:', htmlspecialchars(print_r($lines, true)), '<br />';
flush();
foreach ($lines as $line) {
$bigC++;
if ($bigC >= $fromC) {
$link = Crawler::extract($line, 'href="', '"');
echo 'Opening ', $bigC, ' ', $link, '<br />';
flush();
$c = new Crawler($link);
if ($c->stream) {
$c->go2linewhere('time SG_txtc');
$time = $c->getbetween('>(', ')<');
$blines = $c->getalllineswhere('/orignal/');
$c->close();
unset($c);
//echo '$blines:', htmlspecialchars(print_r($blines, true)),'<br />';
flush();
foreach ($blines as $bline) {
if (strpos($bline, 'url=') === false) {
$blink = Crawler::extract($bline, 'HREF="', '"');
} else {
if (strpos($bline, 'url=') !== false) {
$blink = Crawler::extract($bline, 'url=', '"');
}
}
$blink = str_replace('&690', '', $blink);
echo '<a href="', $blink, '">', $time, "</a><br />\n";
//echo '<a href="', $blink, '">', Crawler::n($bigC, 3), "</a><br />\n";
示例2: flush
require_once "crawler.php";
$istart = 1;
$ifinish = 12;
$start = 'http://photo.blog.sina.com.cn/u/1264425925/page';
$fromC = 0;
extract($_GET);
extract($_POST);
$bigC = 0;
for ($i = $istart; $i <= $ifinish; $i++) {
$bigC = $i * 1000;
$turl = $start . $i;
echo $i, $turl, "<br />\n";
flush();
$c = new Crawler($turl);
if ($c->stream) {
$lines = $c->getalllineswhere('pt_border');
$c->close();
//echo '$lines:', htmlspecialchars(print_r($lines, true)), '<br />';
flush();
foreach ($lines as $line) {
$bigC++;
if ($bigC >= $fromC) {
$link = Crawler::extract($line, '<a href="', '"');
$imgurl = str_replace('photo.blog.sina.com.cn', 'static10.photo.sina.com.cn', $link);
$imgurl = str_replace('/photo/', '/orignal/', $imgurl);
echo "<a href='{$imgurl}'>" . basename($imgurl) . "</a><br/>\n";
}
}
}
flush();
}