From c3d7d830b4989c9ec4d56ec49b6b3ca3c44a9d20 Mon Sep 17 00:00:00 2001 From: schneefux Date: Tue, 2 Sep 2014 13:49:17 +0200 Subject: first commit --- tests/xpath.php | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 tests/xpath.php (limited to 'tests/xpath.php') diff --git a/tests/xpath.php b/tests/xpath.php deleted file mode 100644 index 4e422ad..0000000 --- a/tests/xpath.php +++ /dev/null @@ -1,33 +0,0 @@ - 'xpath', - 'xpath' => 'div[@itemprop="articleBody"]', -); - -$article = array( - 'link' => 'http://www.der-postillon.com/2013/04/nordkoreas-armee-nach-wochenlangem.html', - 'content' => 'This is the feed content', - 'plugin_data' => '', -); - -$doc = new DOMDocument(); -$html = file_get_contents($article['link']); -$doc->loadHTML($html); - -if ($doc) { - $basenode = false; - $xpath = new DOMXPath($doc); - $entries = $xpath->query('(//'.$config['xpath'].')'); // find main DIV according to config - - var_dump($entries); - - if ($entries->length > 0) $basenode = $entries->item(0); - - if ($basenode) { - $article['content'] = $doc->saveXML($basenode); - $article['plugin_data'] = "feedmod,$owner_uid:" . $article['plugin_data']; - } -} - -print_r($article); \ No newline at end of file -- cgit v1.3.1