Bing.php 916 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
<?php

namespace app\Models\parserSkripte;
use App\Models\Searchengine;
use Symfony\Component\DomCrawler\Crawler;

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

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

16
	public function loadResults ($result)
17
18
	{
		
19
		try
20
		{
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
			$crawler = new Crawler($result);
			$crawler->filter('ol#b_results > li.b_algo')->each(function (Crawler $node, $i)
			{
				$title = $node->filter('li h2 > a')->text();
				$link = $node->filter('li h2 > a')->attr('href');
				$anzeigeLink = $link;
				$descr = $node->filter('li div > p')->text();

				$this->counter++;
				$this->results[] = new \App\Models\Result(
					$this->engine,
					$title,
					$link,
					$anzeigeLink,
					$descr,
					$this->gefVon,
					$this->counter
				);
			} );
		} catch ( \ErrorException $e)
		{
			return;
		}
44
45
46
47
48


		
	}
}