Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- date_default_timezone_set("Asia/Jakarta");
- //$root = simplexml_load_file("http://rss.detik.com/index.php/inet");
- //$root = simplexml_load_file("http://rss.nytimes.com/services/xml/rss/nyt/Technology.xml");
- //$root = simplexml_load_file("http://rss.cnn.com/rss/edition_asia.rss");
- //$root = simplexml_load_file("http://feeds.bbci.co.uk/news/technology/rss.xml?edition=uk");
- //$root = simplexml_load_file("http://rss.imdb.com/daily/born/");
- //$root = simplexml_load_file("http://rss.imdb.com/daily/died/");
- //$root = simplexml_load_file("http://news.nationalgeographic.com/index.rss");
- //$root = simplexml_load_file("http://news.nationalgeographic.com/index.rss");
- $root = simplexml_load_file("http://gdata.youtube.com/feeds/base/users/lastdayprod/uploads?client=ytapi-youtube-rss-redirect&v=2&orderby=updated&alt=rss");
- $title = $root->channel->description;
- $link = $root->channel->link;
- $guid = $root->channel->guid;
- $date = $root->channel->pubDate;
- $news = array();
- foreach ($root->channel->item as $data) {
- $temp = array();
- $temp['title'] = (string)$data->title;
- $temp['link'] = (string)$data->link;
- $temp['guid'] = (string)$data->guid;
- $temp['description'] = (string)$data->description;
- $temp['date'] = (string)$data->pubDate;
- $news[] = $temp;
- }
- var_dump($news);
- ?>
- <html>
- <head>
- <title>Detik.com Feed</title>
- </head>
- <body>
- <h1><a href="<?=$link?>" target="_blank"><?=$title?></a></h1>
- <p>Last updated : <?=date("d M Y H:i:s", strtotime($date))?></p>
- <?php foreach ($news as $data) { ?>
- <div style="margin:10px 5px;background:#eee;padding:10px;border-radius:5px;box-shadow:1px 2px 2px rgba(0,0,0,0.5);">
- <h3><a href="<?=$data['link']?>" target="_blank"><?=$data['title']?></a></h3>
- <p>Publication Date : <?=date("d M Y H:i:s", strtotime($data['date']))?></p>
- <div>
- <?=$data['description']?>
- </div>
- </div>
- <?php } ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement