Commit a1049a53 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Fehlende Suchmaschinen aus der Produktsuche eingefügt

parent 820cc0ee
<?php
namespace app\Models\parserSkripte;
use App\Models\Searchengine;
class Ecoshopper extends Searchengine
{
public $results = [];
function __construct (\SimpleXMLElement $engine, \App\MetaGer $metager)
{
parent::__construct($engine, $metager);
}
public function loadResults ($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('//response/result[@name="response"]/doc');
foreach($results as $result)
{
$result = simplexml_load_string($result->saveXML());
$title = $result->xpath('//doc/str[@name="artikelName"]')[0]->__toString();
$link = $result->xpath('//doc/str[@name="artikelDeeplink"]')[0]->__toString();
$anzeigeLink = parse_url($link);
if( isset($anzeigeLink['query']) )
{
parse_str($anzeigeLink['query'], $query);
if( isset($query['diurl']) )
$anzeigeLink = $query['diurl'];
else
$anzeigeLink = $link;
}else
{
$anzeigeLink = $link;
}
$descr = $result->xpath('//doc/str[@name="artikelBeschreibung"]')[0]->__toString();
$this->counter++;
$this->results[] = new \App\Models\Result(
$this->engine,
$title,
$link,
$anzeigeLink,
$descr,
$this->gefVon,
$this->counter
);
}
}
}
<?php
namespace app\Models\parserSkripte;
use App\Models\Searchengine;
class Mg_produkt2 extends Searchengine
{
public $results = [];
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('//response/result[@name="response"]/doc');
foreach($results as $result)
{
$result = simplexml_load_string($result->saveXML());
$title = $result->xpath('/doc/arr[@name="artikelName"]')[0]->{"str"}->__toString();
$link = $result->xpath('/doc/arr[@name="artikelDeeplink"]')[0]->{"str"}->__toString();
$anzeigeLink = parse_url($link);
parse_str($anzeigeLink['query'], $query);
$anzeigeLink = $query['diurl'];
$descr = $result->xpath('/doc/arr[@name="artikelBeschreibung"]')[0]->{"str"}->__toString();
$this->counter++;
$this->results[] = new \App\Models\Result(
$this->engine,
$title,
$link,
$anzeigeLink,
$descr,
$this->gefVon,
$this->counter
);
}
}
}
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment