Skip to content
Snippets Groups Projects
Commit 96a33952 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Merge branch '305-blogsuche-wieder-einbauen' into 'development'

Parser für Blogsuche eingebaut

Closes #305

See merge request !494
parents a9633668 1b3bb1ae
No related branches found
No related tags found
1 merge request!1365Resolve "Filter Options for MetaGer"
<?php
namespace app\Models\parserSkripte;
use App\Models\Searchengine;
class Blogsearch extends Searchengine
{
public $results = [];
public function __construct(\SimpleXMLElement $engine, \App\MetaGer $metager)
{
parent::__construct($engine, $metager);
}
public function loadResults($result)
{
$result = preg_replace("/\r\n/si", "", $result);
try {
$content = simplexml_load_string($result);
} catch (\Exception $e) {
abort(500, "$result is not a valid xml string");
}
if (!$content) {
return;
}
$results = $content->xpath('//xml/docs/doc');
# die(var_dump($results));
foreach ($results as $result) {
$title = $result->{"title"}->__toString();
$link = $result->{"url"}->__toString();
$anzeigeLink = $link;
$descr = $result->{"content"}->__toString();
$this->counter++;
$this->results[] = new \App\Models\Result(
$this->engine,
$title,
$link,
$anzeigeLink,
$descr,
$this->gefVon,
$this->counter
);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment