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(); $image = $result->xpath('//doc/str[@name="artikelImageurl"]')[0]->__toString(); $this->counter++; $this->results[] = new \App\Models\Result( $this->engine, $title, $link, $anzeigeLink, $descr, $this->gefVon, $this->counter, false, $image ); } } catch (\Exception $e) { Log::error("A problem occurred parsing results from $this->name"); return; } } }