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


PHP Crawler::crawlLinks方法代碼示例

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


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

示例1: Crawler

<?php

require 'Crawler.php';
$url = "http://https://lazada.com.ph/";
$crawl = new Crawler();
$crawl->crawlLinks($url);
開發者ID:krizhtin,項目名稱:xtract,代碼行數:6,代碼來源:sample3.php

示例2: Crawler

<?php

include "file:///C|/wamp/www/minor1234/crawler/new/crawler/Crawler.php";
$mycrawler = new Crawler();
//Some site Takes too many Hidden Parameters to Login.
//So it is hard to Login complex Login
$siteloginurl = 'http://www.getacoder.com/users/onlogin.php';
//The url of Form when action perform
$parametes = 'username=Yourusername&passwd=Yourpassword';
//The parameters the action script need
$mycrawler->logIn($siteloginurl, $parametes);
$url = 'http://www.getacoder.com/users/manage.php';
//The url we need to crawl.You cannot go this url before login
//So we need to login.
$link = $mycrawler->crawlLinks($url);
//print the result
echo "<table width=\"100%\" border=\"1\">\n  <tr>\n    <td width=\"30%\"><div align=\"center\"><b>Link Text </b></div></td>\n    <td width=\"30%\"><div align=\"center\"><b>Link</b></div></td>\n    <td width=\"40%\"><div align=\"center\"><b>Text with Link</b> </div></td>\n  </tr>";
for ($i = 0; $i < sizeof($link['link']); $i++) {
    echo "<tr>\n    <td><div align=\"center\">" . $link['text'][$i] . "</div></td>\n    <td><div align=\"center\">" . $link['link'][$i] . "</div></td>\n    <td><div align=\"center\"><a href=\"" . $link['link'][$i] . "\">" . $link['text'][$i] . "</a></div></td>\n  </tr>";
}
echo "</table>";
開發者ID:vikram0602,項目名稱:jiit-connect,代碼行數:21,代碼來源:ExampleLoginCrawlLink.php

示例3: while

    $l = 0;
    while ($row = mysqli_fetch_array($result0)) {
        $sites[$l] = $row[1];
        $s_wait[$l++] = $row[2];
    }
    $result = mysqli_query($con, "SELECT * FROM course where c_id='{$course}'");
    $l = 0;
    while ($row = mysqli_fetch_array($result)) {
        $keyword[$l] = $row[1];
        $waitage[$l++] = $row[2];
    }
}
$temp = array();
$wait = array();
for ($d = 0; $d < sizeof($sites); $d++) {
    $link = $mycrawler->crawlLinks($sites[$d]);
    //print the result
    $k = 0;
    for ($i = 0; $i < sizeof($link['link']); $i++) {
        $sum = 0;
        for ($j = 0; $j < sizeof($waitage); $j++) {
            $c = substr_count($link['link'][$i], $keyword[$j]);
            if ($c) {
                $sum = $sum + $c * $waitage[$j];
            }
        }
        if ($sum > 0) {
            $wait[$k] = $sum * $s_wait[$d];
            $temp[$k++] = $link['link'][$i];
        }
    }
開發者ID:vikram0602,項目名稱:jiit-connect,代碼行數:31,代碼來源:ExampleCrawlLink.php


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