How to get RSS Feed in to my Website using PHP - php

I need to put rss feed in to my website using PHP. For example, I need to get RSS feed from the following site.
http://www.ainonline.com/index.php?id=5
How can i accomplish this.
As i am new bie to RSS i need some professionals help to get a deep knowledge in it.
Hope u pals do...
Thanks in advance...

You can use Zend_Feed class in an MVC project or as a standalone library.
There are examples in the manual.
It is as simple as this:
$channel = new Zend_Feed_Rss('http://www.ainonline.com/index.php?id=5');
foreach ($channel as $item) {
echo $item->title();
}

I found simplepie easy to use and well documented - saves having to understand the details of all the different feed types.

Update Here is a site with a bunch of php scripts, including RSS scripts: http://gscripts.net/free-php-scripts/RSS_Scripts.html
If you are wanting to create the entire thing from scratch check this link out. I haven't walked through the whole thing myself, but it seems nice.
http://tiffanybbrown.com/2005/12/22/dynamic-rss-feeds-using-php-mysql-and-apache/
I recommend that you know php and MySql as well as maybe reading a few tutorials about how RSS works.
Also, you could check out the RSS code in WordPress, that's what I did, though It may be a bit complicated to reverse engineer it, versus just reading tutorials and learning it from the ground up correctly.:)

Take a look at this:
http://ditio.net/2008/06/19/using-php-curl-to-read-rss-feed-xml/

Related

Automatically generate RSS feeds

I have information stored in a database that I want to use to create RSS feeds.
What is the best way to do this?
Also, are there any PHP library/functions that I can pass the data to and they will take care of ensuring that any characters that need to be encoded/stripped are dealt with?
PHP Universal Feed Generator is the one you are looking for.
It supports RSS 1.0, RSS 2.0 and ATOM
If you know how to dynamically create an XML, it's pretty much the same, you just need to look on way to format an RSS, and off you go.
After you created the rss - you can validate it here:
http://validator.w3.org/feed/
Here is a short wiki article on how it's supposed to be formatted: http://en.wikipedia.org/wiki/Rss
I prefer the Zend_Feed component, which is part of Zend Framework. Just have a look at Zend_Feed_Writer in the Reference Guide, to see how to export data as a feed.
http://careers.stackoverflow.com/jobs/feed
Just look at this RSS-example (right click for Source Code). It's a functional and used RSS and all you really need is to create a HTML-similiar page with dynamic data yourself.
EDIT:
I personally don't see the point of using a plugin for this. It's so similiar to HTML that you may aswell just create it with given tags in above example.

Using PHP with Google Base and general feed questions

So I've been looking into using google base for a clients job listing project. Are there any good tutorials on using PHP and curl to interact with the google base API? I was having trouble finding one on google. I attempted to cURL to the following URL: http://www.google.com/base/feeds/snippets?bq=digital+camera and working with the XML, but it didn't seem to be properly formatted XML.
I'm pretty new to dealing with feeds although I've used simpleXML and DOMDocument quite a bit so I figure this won't be too hard.
Any ideas?
Thanks in advance.
Check here.

PHP: RSS parsing

I want to parse a websites news section. It has a RSS subscribe button but the outlook looks odd and I'm not sure how to parse it.
http://www.networkroi.co.uk/DesktopModules/ArticleManager/ArticleRss.aspx?id=324&pid=0
It's not in XML which would have been a lot easier.
Here is the news page with that link on it - http://www.networkroi.co.uk/News/tabid/99/Default.aspx
I would like to parse it with PHP if possible, though I really just want to dislay the info as it looks there..
Any help most appreciated
Jonesy
Take a look at excellent SimplePie class for parsing rss feeds with PHP.
SimplePie is a very fast and
easy-to-use class, written in PHP,
that puts the 'simple' back into
'really simple syndication'. Flexible
enough to suit beginners and veterans
alike, SimplePie is focused on speed,
ease of use, compatibility and
standards compliance.

Getting search results from Twitter in php

I'm attempting to put together a little mashup with some twitter APIs. However, the whole area is new to me (I'm more of an embedded developer dabbling). And frustratingly, every tutorial I am trying in Php is either out of date, not doing what it claims to do, it or is broken.
Essentially, I just want a nice bit of example code - say, an HTML file, a connection.js for the JQuery magic, and a php file - 'getsearch' which contains the relevant Curl calls to the API to just return the results for a given search term.
Followed the tutorial to the letter at
http://www.reynoldsftw.com/2009/02/using-jquery-php-ajax-with-the-twitter-api/
and even downloaded the guy's code and chucked it on my webserver, but it just seems to sit there.
I'm relatively competent at php and html, but it's the Curl and the JQuery side of things which is new to me, and would appreciate any thoughts, links, or code suggestions. I've attempted reading the API - but even that seems sparse - and several links are broken to their own tutorials, so that's put me off a bit for now.
Finally found a working one.
http://papermashup.com/using-the-twitter-api/
This tutorial (or just the php file at http://greenservr.com/projects/twittersearch/TwitterSearch.phps) has the basics including php, jquery and curl to get something back from the twitter API). Finally have something going, so now can expand and extend :)
check the link http://webhkp.wordpress.com/2010/04/13/twitter-api-search-follow-tweet/. this is a great post i found and really helpful for me. hope you fined something helpful here.

Simplehtmldom - curl, loops, arrays?

Pse forgive what is most likely a stupid question. I've successfully managed to follow the simplehtmldom examples and get data that I want off one webpage.
I want to be able to set the function to go through all html pages in a directory and extract the data. I've googled and googled but now I'm confused as I had in my ignorant state thought I could (in some way) use PHP to form an array of the filenames in the directory but I'm struggling with this.
Also it seems that a lot of the examples I've seen are using curl. Please can someone tell me how it should be done. THere are a significant number of files. I've tried concatenating them but this only works with doing this through an html editor - using cat -> doesn't work.
You probably want to use glob('some/directory/*.html'); (manual page) to get a list of all the files as an array. Then iterate over that and use the DOM stuff for each filename.
You only need curl if you're pulling the HTML from another web server, if these are stored on your web server you want glob().
Assuming the parser you talk about is working ok, you should build a simple www-spider. Look at all the links in a webpage and build a list of "links-to-scan". And scan each of those pages...
You should take care of circular references though.

Categories