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.
Related
Is it right way to scrape other websites contents into my website using simple_html_dom. If it is wrong, suggest me what is the method to display news in my website.
simple_html_dom is some extension I am guessing. If you are looking for something in Core PHP(PHP Extension), use DOMDocument
Basically by scraping you are taking the sites content. And if you are doing the same with their(sites team) consent then its okay, otherwise its not legal(depends on their T&C). Also sites have mechanism to block such acts.
Better ask the site team for content, they might be able to provide the data in much better and simpler way. Like API, RSS or a direct Database.
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.
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/
I am searching an RSS parser written in PHP. The problem is not that I cannot find one. The problem is that there are too many and it's hard to decide which one to use (especially when I have no experience with them and to try them is too time consuming).
Can anybody recommend me a "good" RSS parser?
The following requirements are important to me (given in order of importance):
It's able to extract all information given in the feed (not only title, description and link but everything what is there, for example feeds author, feeds icon, items tags and so on).
It should be able to read not only RSS feeds but also Atom feeds.
It should be tolerant to "broken" RSS (Atom) feeds.
It should be simple to use.
My defacto answer will be "have you tried SimplePie?", it's a very good XML parser but you'll have to have a look at their demo to see how it handles broken feeds :-)
In addition to SimplePie already mentioned, there is Zend_Feed (which can be used standalone) and since this is XML anyway, you can also use any of the native XML extensions, like DOM or XMLReader.
I've got a number of REST feeds I'd like to store in a MYSQL database, can anyone suggest a solution for this? Something PHP related appreciated....
It's not PHP related, but PERL has both a REST interface and a DBI interface (for interfacing with MYSQL).
http://metacpan.org/pod/WWW::REST
There are many other REST interfaces for Google, Twitter, etc. Just search CPAN modules at search.cpan.org
To my knowledge there is no such thing as a REST feed. There are RSS feeds and Atom feeds, so I will assume you are talking about one of those.
Both are based on XML so I suggest you find an XML parser for PHP and do an HTTP request to get the feed contents, parse the XML into a DOM and then copy the DOM data into MYSQL!
I'm not sure how to be more precise.
Are you looking for someone to write the code?
Ok, I'm assuming you are talking about "RSS" feeds. Here's a great opensource library that makes it easy -- http://simplepie.org/ . Point it at an RSS or Atom feed, it will give you back PHP arrays and objects. From there you can interpret them and save them any way you want.
Depending on what you actually want to do with the database, you could use RSS as an XML clob format. Not fast, but easy. Again, it totally depends on what you want to do with the database.