PHP Classes

File: example.php

Recommend this page to a friend!
  Packages of Bhaktaraz Bhatta   PHP RSS Generator   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP RSS Generator
Generate a RSS feed with a fluent interface
Author: By
Last change:
Date: 9 years ago
Size: 5,598 bytes
 

 

Contents

Class file image Download
<?php

use Bhaktaraz\RSSGenerator\Item;
use Bhaktaraz\RSSGenerator\Feed;
use Bhaktaraz\RSSGenerator\Channel;

require 'vendor/autoload.php';

$feed = new Feed();
$channel = new Channel();
$channel
    ->title("Channel Title")
    ->description("Channel Description")
    ->url('http://bhaktaraz.com.np')
    ->language('en-US')
    ->copyright('Copyright 2015, Bhaktaraz')
    ->pubDate(strtotime('Tue, 21 Aug 2012 19:50:37 +0900'))
    ->lastBuildDate(strtotime('Tue, 21 Aug 2012 19:50:37 +0900'))
    ->updateFrequency(1)
    ->updatePeriod('hourly')
    ->ttl(60)
    ->appendTo($feed);

$item = new Item();
$item
    ->title("Item Title")
    ->creator("Deepak Pandey")
    ->description("Item body")
    ->content("<p class=\"popPara\" style=\"text-align: justify;\"><a href=\"http://www.onlinekhabar.com/wp-content/uploads/2015/11/kathmandu_view_tower_Old_buspark.jpg\"><img class=\"aligncenter wp-image-349218\" src=\"http://www.onlinekhabar.com/wp-content/uploads/2015/11/kathmandu_view_tower_Old_buspark.jpg\" alt=\"kathmandu_view_tower_Old_buspark\" width=\"810\" height=\"523\" srcset=\"http://www.onlinekhabar.com/wp-content/uploads/2015/11/kathmandu_view_tower_Old_buspark.jpg 650w, http://www.onlinekhabar.com/wp-content/uploads/2015/11/kathmandu_view_tower_Old_buspark-300x194.jpg 300w\" sizes=\"(max-width: 810px) 100vw, 810px\" /></a>?? ???, ???????? ? ??????? ????????? ?????? ???? ?????? ????????? ????? ??????? ???????? ?????? ??????? ????? ???????? ????? ? ?</p>
<p class=\"popPara\" style=\"text-align: justify;\">???? ????????? ???????? ??????? ??????? ???????????? ?????? ??????? ????? ???? ???? ???? ???? ????????? ?????? ????? ???????, ??????? ? ??????? ?????? ???? ???????? ??????? ??? ? ???? ?????? ???????, ??????, ?????? ????????????? ???????????? ???? ??? ????????? ????? ??????? ???????????? ? ?</p>
<p class=\"popPara\" style=\"text-align: justify;\">??? ?????? ????????? ??????? ?????? ??????? ? ? ??????? ?????? ??????? ???? ????? ???????? ? ??????? ?????? ??????? ??????? ??? ???? ??????? ? ?</p>
<p>?????????? ?????????? ??? ??????? ???? ??? ?? ??????? ???? ???? ?????? ????????? ??????? ????? ??? ????????? ??????? ???????????? ??????????? ???????? ? ?</p>
<p>????????????? ??? ????????? ??????? ?????? ?????? ??? ?????????? ?????? ????????????? ? ?? ??????? ?????? ????? ? ? ??????? ??????? ????? ???????? ???? ? ?????????????? ?????? ???, ???????? ??????? ????? ???? ??????? ? ?</p>
<p>???????? ????? ????????????? ?? ???????? ????? ??????? ??? ????? ?? ???????? ?????? ??? ? ??? ???? ???? ???? ????????? ?? ???? ?????????????? ? ?</p>
<p>?????? ???? ?? ??? ???? ?? ???? ?????? ?????? ?????? ???????????? ???????? ??????????? ???????? ???????? ??????? ? ????? ???????? ????? ????? ???? ??????? ???? ? ? ???????, ?????? ???? ??? ????? ????? ?????? ???????, ????????? ?????? ??, ???? ?????, ?????????, ???? ??? ?????????????? ??? ???????????? ????? ? ????? ???? ?? ????? ???? ??? ????? ?????????? ? ?</p>")
    ->url('http://bhaktaraz.com.np/?p=2')
    ->pubDate(strtotime('Mon, 03 Aug 2015 10:22:02 +0550'))
    ->guid('http://bhaktaraz.com.np/?p=2', true)
    ->appendTo($channel);


echo $feed; // or echo $feed->render();