Training, Open Source computer languages

PerlPHPPythonMySQLhttpd / TomcatTclRubyJavaC and C++LinuxCSS

Search our site for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
Caching an XML feed
If you're using PHP to add a newsfeed to your site, please be kind to the news feed supplier and cache the feed if your page is a popular one. I posted a couple of weeks ago ... a link to a piece of code that grabs a news feed .... and I've enhanced it now to do the caching. Here's the modified code:

$feed = "http://thescotsman.scotsman.com/uk.cfm?format=rss";
$copy = 1;
if (time() - @filemtime("haggis.xml") < 120) {
$feed = "haggis.xml";
$copy = 0;
}

$fh = fopen($feed,"r");
if ($copy) $saver = fopen("haggis.xml","w");
while ($xmlcontent = fread($fh,1024)) {
if ($copy) fputs($saver,$xmlcontent);
xml_parse($parser,$xmlcontent,feof($fh));
}

Links ...
Previous posting
Original full source code listsing
Running Script

(written 2005-08-26 18:39:20)

 
Associated topics are indexed under
G905 - Well House Consultants - Blog Admin
H112 - PHP - Further Web Page and Network Handling

Back to
How not to run a forum
Previous and next
or
Horse's mouth home
Forward to
Robust checking of data entered by users

Some other Articles
Charlie on Monday
Swindon - Chippenham - Melksham - Trowbridge - Westbury train service
The Melksham train - a button is pushed
Robust checking of data entered by users
Caching an XML feed
How not to run a forum
A Victorian Lady
PHP Magic Quotes
Don't repeat code - use loops or functions
Towards Tebay
1636 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

© WELL HOUSE CONSULTANTS LTD., 2008: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 707126 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho