Can you do RSS feeds on a local server? (PHP) - php

I am using XAMPP and was wondering if I can code my site to include RSS feeds. Would the codes work and can I test it if I am working on a local server?
I am practicing using the OReily head First PHP/Mysql book and I'm on the chapter on RSS and getting RSS videos from youtube.

You can create a RSS feed and test it locally, no problem. In the end it is not different from testing your other pages besides that the URL pointing to the RSS feed does not return HTML but XML.

You can make a feed, but you have to upload them online, so other people can see and use them.
But it will work similar to online-version on localhost.

Why don't you just test it?
Usually there is no problem with getting RSS
But if there will be one - that will be time to come here to SO with the question
if you want to make your own RSS feed, it's not a big deal too. RSS is the same markup as HTML.

Related

Simplepie not recognising wordpress RSS

$feed->set_feed_url(array('http://chrisheadleand.com', 'http://glaciem-world.com/feed/'));
$feed->set_autodiscovery_level(SIMPLEPIE_LOCATOR_ALL);
Is there any reason in simplepie why these domains wont parse into a HTML page? The only RSS I seam to be able to get simplepie to work with so far is the twitter RSS feeds
eg
http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=thenextweb
I need to get this working (with autodetect) for rss feeds from wordpress and blogger websites..
Can anyone point me in the right direction?
Cheers
CJ
Update
I figured out how to get the error messages from sinmplepie
I'm now getting the follwoing information
http://www.clearthemist.com/test/
Can anyone explain what this means and how I can fix it.
The url I'm using is http://chrisheadleand.com - It works fine on simplepies web demo but not on my site. I have tried two different versions of simplepie with no better results.
Simple answer to this one is that there seams to be a problem with simplepie if the header information in the RSS feed is slightly unconventional. I unstalled the latest version of wordpress and it worked fine.
Cheers for reading!

extract complete content of websites via feed in php

i want get complete content of a news or post of a website via feed. but we know that many websites only presents some part of news or post via their feed.
of course i know that exists a script called SimplePie that is developed for get content of websites via feed. but this script do not retrieve full content of a news.
of course i found a script called Full-Text Feeds that do It. but it is no free . i want a free script.
Do you know a similar script or way to do my need?
The code behind Five Filters' content extraction is actually open source, and is based on Readability's original Javascript (before they became a service).
You should be able to use it like this:
$page = file_get_contents($item_url);
$readability = new Readability($page);
if ($result = $readability->init()) {
$content = $readability->getContent()->innerHTML;
}
Not entirely sure what you're trying to do here but this might help you:
$full_page_content = file_get_contents('http://www.example.com/');
Edit: Ok, if I understand you correctly you'll need to do something like this:
Get rss feed
Use SimplePie or something like it to go through each feed item
For each item in RSS feed
Get the item's url
Get the content from that URL
Strip out the HTML/extract only the text you need
Combine all of these into a new RSS feed and send that to the user
Note: This isn't a simple thing to do. There is a reason that Full-Text RSS can charge for their product.
You could use http://magpierss.sourceforge.net/cookbook.shtml (free)
It retrieves RSS feeds. There are many many many PHP scripts that do that on the web... Google si your friend !! :)

RSS feed generation and implementation

I am a fresher to Rss feeds.
I have read some sites related to rss feed.But i didn't get full picture about it.
I understand that ,i need to create a xml for displaying my site contents as feed in another site.
For example
i have two php sites
www.site1.com
www.site2.com
And there is page feed.xml in site1.com, which has the latest feeds
Let me know , what are the general methods to display these feeds to other site www.site2.com
Also , where can i see the general format of xml used for rss
On www.site2.com
Fetch RSS using a RSS library from www.site1.com
Parse
Display
You can use Simplepie RSS library for this purpose. See http://simplepie.org
See HERE for the general format.
You can find PHP-RSS-Parsers HERE, HERE or HERE.

getting real link from rss feed link

I am experimenting with scraping certain pages from an RSS feed using curl and php. The page scraping was working fine when I was just using actual links, not links from the rss feeds. However, I realize now that links in rss feeds are usually just redirects to the actual page (at least this is what it seems like). Because now when I scrape a page with the rss link, it doesn't actually get the information I am looking for.
Has anyone encountered this and know of a workaround. Is there anyway to see where the rss link is redirecting to and capturing that value?
I think you might need to use the -L switch to tell it to follow redirects. I'm not sure if you can do this directly from PHP or whether you need to follow this approach http://php.net/manual/en/function.curl-setopt.php#95027. It is always possible that the site you are scraping blocks by user agent or something as well. Maybe try one of the links in a browser while running Fiddler or similar to see if any redirection is actually taking place.

How to create an RSS feed and display it?

On a website I am maintaining for a radio station they have a page that displays news articles. Right now the news is posted in an html page which is then read by a php page which includes all the navigation. I have been asked to make this into and RSS feed. How do I do this? I know how to make the XML file but the person who edits the news file is not technical and needs a WYSIWYG editor. Is there a WYSIWYG editor for XML? Once I have the feed how do I display it on my site? Im working with PHP on this site so a PHP solution would be preferred.
Use Yahoo Pipes! : you don't need programming knowledge + the load on your site will be lower. Once you've got your feed, display it on your site using a simple "anchor" with "image" in HTML. You could consider piping your feed through Feedburner too.
And for the freeby: if you want to track your feed awareness data in rss, use my service here.
Are you meaning that someone will insert the feed content by hand?
Usually feeds are generated from the site news content, that you should already have into your database.. just need a php script that extract it and write the xml.
Edit: no database is used.
Ok, now you have just 2 ways:
Use php regexp to get the content you need from the html page (or maybe phpQuery)
As you said, write the xml by hand and then upload it, but i havent tryed any wysiwyg xml editor, sorry.. there are many on google
Does that PHP site have a database back end? If so, the WYSIWYG editor posts into there then a special PHP file generates an RSS feed.
I've used the following IBM page as a guide and it worked wonderfully:
http://www.ibm.com/developerworks/library/x-phprss/
I decided that instead of trying to find a WYSIWYG for XML that I would let the news editor continue to upload the news as HTML. I ended up writing a php program to find the <p> and </p> tags and creating an XML file out of it.
You could use rssa.at - just put in your URL and it'll create a RSS feed for you. You can then let people sign up for alerts (hourly/daily/weekly/monthly) for free, and access stats.
If the HTML is consistent, you could just have them publish as normal and then scrape a feed. There are programatic ways to do this for sure but http://www.dapper.net/dapp-factory.jsp is a nice point and click feed scraping service. Then, use either MagpieRSS, SimplePie or Feed.informer.com to display the feed.

Categories