Fastbot.php 1015 Bytes
Newer Older
1
2
<?php

3
4
namespace app\Models\parserSkripte;
use App\Models\Searchengine;
5
6
7
8
9

class Fastbot extends Searchengine 
{
	public $results = [];

10
	function __construct (\SimpleXMLElement $engine, \App\MetaGer $metager)
11
	{
12
		parent::__construct($engine, $metager);
13
14
		if ( strpos($this->urlEncode($metager->getEingabe()), "%") !== FALSE )
		{
15
			$this->enabled = false;
16
			return null;
17
		}
18
19
	}

20
	public function loadResults ($result)
21
	{
22
23
		$result = utf8_encode($result);
		$counter = 0;
24
25
26
27
28
29
30
31
32
		foreach( explode("\n", $result) as $line )
		{
			$line = trim($line);
			if( strlen($line) > 0 ){
				# Hier bekommen wir jedes einzelne Ergebnis
				$result = explode("|:|", $line);
				$link = $result[1];
				$link = substr($link, strpos($link, "href=\"") + 6);
				$link = substr($link, 0, strpos($link, "\""));
33
				$counter++;
34
				$this->results[] = new \App\Models\Result(
35
					$this->engine,
36
37
38
					trim(strip_tags($result[1])),
					$link,
					$result[3],
39
					$result[2],
40
41
					$this->gefVon,
					$counter
42
43
44
45
					);
			}
			
		}
46

47
48
	}
}