<?php namespace app\jobs; use Yii; use PHPHtmlParser\Dom; use app\components\Collection; use yii\base\BaseObject; use \yii\queue\JobInterface; class HostJob extends BaseObject implements JobInterface { //yii queue/listen -v --color // https://github.com/paquettg/php-html-parser public $host; public $grabSource; public function execute($queue) { echo $this->host; $result = Collection::getRawData($this->grabSource, $this->host); if (!$result['errorno']) {//без ошибок $dom = new Dom; $dom->loadStr($result['data']); $table = $dom->getElementById('#resultcontainer'); if ($table) { $td = $table->find('td'); foreach ($td as $t) { echo $t->text."\n"; } } // echo $a->text; } return null; } }