| Conditions | 3 |
| Paths | 3 |
| Total Lines | 25 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | function scraping_lebensmittelwarnung($url) |
||
| 6 | { |
||
| 7 | // init |
||
| 8 | $return = []; |
||
| 9 | |||
| 10 | // create HTML DOM |
||
| 11 | $dom = \voku\helper\HtmlDomParser::file_get_html($url); |
||
| 12 | |||
| 13 | foreach ($dom->findMulti('item') as $item) { |
||
| 14 | $title = $item->getElementByTagName('title')->text(); |
||
| 15 | |||
| 16 | $return[$title]['Produkt'] = $title; |
||
| 17 | $return[$title]['DatumTime'] = date('Y-m-d H:m:s', strtotime($item->getElementByTagName('pubDate')->text())); |
||
| 18 | $return[$title]['Link'] = $item->getElementByTagName('link')->text(); |
||
| 19 | $return[$title]['Beschreibung'] = nl2br($item->getElementByTagName('description')->text()); |
||
| 20 | |||
| 21 | if (strpos($return[$title]['Beschreibung'], 'Gefahr') !== false) { |
||
| 22 | $return[$title]['Gefahr'] = '!!!!!!!!!!!!!!!'; |
||
| 23 | } else { |
||
| 24 | $return[$title]['Gefahr'] = ''; |
||
| 25 | } |
||
| 26 | } |
||
| 27 | |||
| 28 | return $return; |
||
| 29 | } |
||
| 30 | |||
| 39 | } |