getURI(); $html = getSimpleHTMLDOM($pageUrl) or returnServerError('Could not request webpage: ' . $pageUrl); foreach ($html->find('.entry') as $element) { if (count($this->items) >= 20) { break; } $modelTagsContainer = $element->find('.model-tags-container', 0); $dateElement = $element->find('.entry-date', 0); $contentElement = $element->find('.entry-content', 0); if (!$modelTagsContainer || !$dateElement || !$contentElement) { continue; } $modelTags = $modelTagsContainer->find('.model-tag'); $modelNames = array(); foreach ($modelTags as $tag) { $modelNames[] = trim(strip_tags($tag->innertext)); } if (empty($modelNames)) { continue; } $dateStr = trim(strip_tags($dateElement->innertext)); $content = $contentElement->innertext; $timestamp = strtotime($dateStr); $modelList = implode(', ', $modelNames); $title = 'First Impression: ' . $modelList; $anchorLink = $modelTagsContainer->find('.anchor-link', 0); $anchorId = ''; if ($anchorLink) { $href = $anchorLink->href; $anchorId = str_replace('#', '', $href); } else { $anchorId = strtolower(str_replace(' ', '-', $modelNames[0])); $anchorId = preg_replace('/[^a-z0-9\-]/', '', $anchorId); } $uri = $this->getURI() . '#' . $anchorId; $item = array(); $item['uid'] = $uri; $item['uri'] = $uri; $item['title'] = $title; $item['content'] = $content; $item['timestamp'] = $timestamp; $item['author'] = 'Dubesor'; $this->items[] = $item; } } }