rss parser by php

$doc = new DOMDocument();
$doc->load(‘http://abdul.in.th/rss/iphone/’); // URL
$arrFeeds = array();
foreach ($doc->getElementsByTagName(‘item’) as $node) {
$itemRSS = array (
‘title’ => $node->getElementsByTagName(‘title’)->item(0)->nodeValue,
‘desc’ => $node->getElementsByTagName(‘description’)->item(0)->nodeValue,
‘link’ => $node->getElementsByTagName(‘link’)->item(0)->nodeValue,
‘date’ => $node->getElementsByTagName(‘pubDate’)->item(0)->nodeValue
);
array_push($arrFeeds, $itemRSS);
}

ใส่ความเห็น

อีเมลของคุณจะไม่แสดงให้คนอื่นเห็น ช่องข้อมูลจำเป็นถูกทำเครื่องหมาย *

This site uses Akismet to reduce spam. Learn how your comment data is processed.