Qualigo.php 912 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
<?php

namespace App\Models\parserSkripte;

use App\Models\Searchengine;

class Qualigo extends Searchengine
{

10
	function __construct (\SimpleXMLElement $engine, \App\MetaGer $metager)
11
	{
12
		parent::__construct($engine, $metager);
13
14
	}

15
	public function loadResults ($results)
16
	{
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
		try {
			$content = simplexml_load_string($results);
		} catch (\Exception $e) {
			abort(500, "$result is not a valid xml string");
		}
		
		if(!$content)
		{
			return;
		}
		$results = $content->xpath('//RL/RANK');
		foreach($results as $result)
		{
			$title = $result->{"TITLE"}->__toString();
			$link = $result->{"URL"}->__toString();
			$anzeigeLink = $result->{"ORIGURL"}->__toString();
			$descr = $result->{"ABSTRACT"}->__toString();
			$this->counter++;
			$this->ads[] = new \App\Models\Result(
				$this->engine,
				$title,
				$link,
				$anzeigeLink,
				$descr,
				$this->gefVon,
				$this->counter
			);
		}
45
46
47
	}

}