PHP RSS feed script
RSS Reader PHP code
function get_feed($link)
{
$this->load->helper('text');
$last_update = time();
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json');
// Load RSS Parser
$this->load->library('rssparser');
// Get 6 items from arstechnica
$rss = $this->rssparser->set_feed_url($link)->set_cache_life(30)->getFeed(5);
foreach ($rss as $item)
{
$pubdate = strtotime($item['pubDate']);
$monthName = date("F", mktime(0, 0, 0, date("m",$pubdate), 10));
$new_date = date("d.",$pubdate).' '.$monthName.' '.date("Y",$pubdate).' '.date("H:i",$pubdate);
$array[] = array(
'title' => $item['title'],
'description' => character_limiter($item['description'],100),
'author' => $item['author'],
'pubDate' => $new_date,
'link' => $item['link']
);
}
$array = json_encode($array);
return $array;
}
Php Interview-questions-with-answers
Php code for valid number
Php file uploading code
Php by code
Advanced php
Php global variables
Top 550 php interview-questions
RSS Reader PHP code
function get_feed($link)
{
$this->load->helper('text');
$last_update = time();
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json');
// Load RSS Parser
$this->load->library('rssparser');
// Get 6 items from arstechnica
$rss = $this->rssparser->set_feed_url($link)->set_cache_life(30)->getFeed(5);
foreach ($rss as $item)
{
$pubdate = strtotime($item['pubDate']);
$monthName = date("F", mktime(0, 0, 0, date("m",$pubdate), 10));
$new_date = date("d.",$pubdate).' '.$monthName.' '.date("Y",$pubdate).' '.date("H:i",$pubdate);
$array[] = array(
'title' => $item['title'],
'description' => character_limiter($item['description'],100),
'author' => $item['author'],
'pubDate' => $new_date,
'link' => $item['link']
);
}
$array = json_encode($array);
return $array;
}
Php Interview-questions-with-answers
Php code for valid number
Php file uploading code
Php by code
Advanced php
Php global variables
Top 550 php interview-questions