Re: Parse XML or RSS feeds into your controller
I wrote a quick script for you. (I do this for a living. Also, I like
crosswords.)
# Script WordOfTheDay.txt
var str rss, title, link, description
cat "http://wordsmith.org/awad/rss1.xml" > $rss
while ( { sen -r -c "^<title&\>&</description&\>^" $rss } > 0 )
do
stex -r -c "^<title&\>^]" $rss > null
stex -r -c "]^</title&\>^" $rss > $title
stex -r -c "^<link&\>^]" $rss > null
stex -r -c "]^</link&\>^" $rss > $link
stex -r -c "^<description&\>^]" $rss > null
stex -r -c "]^</description&\>^" $rss > $description
echo $title "\n----" $link "\n--------" $description
done
Copy and save the script into file C:/Scripts/WordOfTheDay.txt, start
biterscripting ( http://www.biterscripting.com ), and enter the
following command.
script "C:/Scripts/WordOfTheDay.txt"
Today, when I ran it, I am getting the following.
Wordsmith.org: Today's Word
----http://wordsmith.org/
--------The magic of words - that's what Wordsmith.org is about.
onomatomania
----http://wordsmith.org/words/onomatomania.html
--------An obsession with particular words or names and desire to
recall or repeat them.
You can call this script directly from php. For me, I have created an
icon on my desktop with the following command.
"C:/biterScripting/biterScripting.exe" "C:/Scripts/WordOfTheDay.txt" -
oo "X.txt" ; start "X.txt"
Each day, when I click it, I will see the new word for that day. Nice
site - this wordsmith.org.
On Dec 14, 5:38 am, appel268576 <appel268...@gmail.com> wrote:
> Hi guys,
>
> I am looking at making use of certain RSS feeds, XML files from a site
> to display certain content on their.
> I have tried with simplepie but no luck.
>
> Is there anybody that could tell me if there are any solutions to help
> you too display RSS in your controllers.?
>
> Controller
>
> <?php
>
> class RssController extends AppController{
> var $name = "Rss";
> var $components = array('Simplepie');
> // As the RSS will not currently use a database
> var $uses = array();
>
> function index() {
> App::import('Xml');
> $file = "feed://wordsmith.org/awad/rss1.xml";
>
> $parsed_xml =& new XML($file);
> $parsed_xml = Set::reverse($parsed_xml);
>
> debug($parsed_xml);
> echo $parsed_xml;
> }
>
> }
>
> ?>
>
> dont know where to start with the view...
>
> any help would be appreciated.
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home