PHP code example of yurunsoft / crawler

1. Go to this page and download the library: Download yurunsoft/crawler library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

yurunsoft / crawler example snippets



namespace Yurun\CrawlerApp\Module\YurunBlog\Article\Model;

use Yurun\Crawler\Module\Parser\Annotation\DomSelect;
use Yurun\Crawler\Module\Parser\Enum\DomSelectMethod;
use Yurun\Crawler\Module\DataModel\Contract\BaseDataModel;

/**
 * 文章内容模型
 */
class ArticleModel extends BaseDataModel
{
    /**
     * 标题
     * 
     * @DomSelect(selector=".article-view h1", method=DomSelectMethod::TEXT)
     *
     * @var string
     */
    public $title;

    /**
     * 内容
     *
     * @DomSelect(selector=".article-content", method=DomSelectMethod::HTML)
     * 
     * @var string
     */
    public $content;

    /**
     * 时间
     *
     * @DomSelect(selector=".article-info .time", method=DomSelectMethod::TEXT)
     *
     * @var string
     */
    public $time;

}