diff --git a/bridges/WarhammerComBridge.php b/bridges/WarhammerComBridge.php new file mode 100644 index 00000000..e37635de --- /dev/null +++ b/bridges/WarhammerComBridge.php @@ -0,0 +1,51 @@ + true, + CURLOPT_POSTFIELDS => $data, + CURLOPT_RETURNTRANSFER => true + ]; + + $json = getContents($url, $header, $opts); + $json = json_decode($json); + + foreach ($json->news as $article) { + $articleurl = static::URI . $article->uri; + + $fullarticle = getSimpleHTMLDOMCached($articleurl); + $content = $fullarticle->find('.article-content', 0); + + $categories = []; + foreach ($article->topics as $topic) { + $categories[] = $topic->title; + } + + $this->items[] = [ + 'title' => $article->title, + 'uri' => static::URI . $article->uri, + 'timestamp' => strtotime($article->date), + 'content' => $content, + 'uid' => $article->uuid, + 'categories' => $categories + ]; + } + } +}