foreach html- find with-image as element item_href base_href element-

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
foreach($html->find('p.with-image') as $element) {
$item_href = $base_href.$element->find('span.text a', 0)->href;
$page_html = \Sunra\PhpSimple\HtmlDomParser::file_get_html($item_href);
\News\Post::create([
'title' => trim($page_html->find('div.rssblock h1', 0)->plaintext),
'category_id' => 2,
'image' => '',
'alias' => '',
'tags' => '',
'time_add' => '',
'desc' => $page_html->find('div.bignews', 0)->plaintext,
'short_desc' => $page_html->find('div.bignews', 0)->plaintext,
'meta_title' => $page_html->find('div.rssblock h1', 0)->plaintext,
'region_id' => 69,
'publish' => 1,
'user_id' => 0,
]);
$page_html->clear();
unset($page_html);
}