lobive.blogg.se

Feed reader php script
Feed reader php script












  1. Feed reader php script pdf#
  2. Feed reader php script update#

More documentation on usort() can be found in the php.net man pages. Timesort() function (lines 102-107) is just a black box that sorts an array of arrays in descending sequence by a named key. In our case these data pairs are our sub-arrays. It walks the main array and presents each pair of data elements to an external function named in the second argument to usort().

Feed reader php script pdf#

It makes sense to list the most recent PDF publications first, and to do that we need to sort the array of arrays. More probably we have found some PDF files and we would want to display them. It is possible in theory, that there would be no PDF files in the directory and we test for this condition on line 40. We collect these arrays into an array of arrays on line 34. Each file is represented by an associative array containing the name, the size and the time the file was last modified. Our first important PHP task is to get a list of the PDF files that are in the directory. Since the script will create or re-create these files at run time, we did not need to do any initialization or special preparation of other files and scripts. $rss is the name of the XML file that contains our RSS feed. $md5 is the name of the file that contains a message digest string (more on that later). We have two hard-wired file names in the script. Having only one script kept everything in one place and made our debugging very easy. Because cron jobs simply discard browser output, it seemed fine to merge the functions of listing the directory and writing the RSS feed into a single script.

Feed reader php script update#

Whenever the client added a PDF to the directory the audience would get an RSS update within a few minutes. And we set up a "cron" job that ran this index.php script every 15 minutes.

feed reader php script

We installed this script as the "index.php" script in the PDF directory. That change would trigger the writing of the new XML file that contained our RSS feed.

feed reader php script

If the new md5() string did not match the old md5() string, we had detected a change in the directory. Since we needed a way to know when the directory had changed, we decided to collect the list of files and make an In practice there was a little more styling than you will see here, but all the moving parts are the same. We set up a simple script to list the PDF files in its directory. So we built a PHP script to handle the RSS publishing. The investment company did not want to be bothered with the technical details of trying to create and store an XML string on the server. You subscribe to RSS feeds by telling the RSS reader what URL to follow. The reader gives you a "heads-up" if anything is new or changed. It reads the current XML file from each of those URLs and compares it to the older version of the file (if any). Whenever the clock expires, the reader goes to its list of URLs that point to RSS feeds. The typical design of an RSS reader is a small "system-tray" program with a time clock in it. And almost all web browsers can consume RSS feeds. svg.pngĪn RSS feed is usually consumed by an RSS reader program. g/wikipedi a/commons/ thumb/4/43 /Feed-icon. More information on RSS is available here:Īnd just for fun, the largest RSS icon I have ever seen is available here: We chose RSS because everyone at the meeting had heard of it, perhaps because it also forms the basis for podcasting. A competing standard, Atom, is quite similar. It carries only a few bits of information, such as a title, description and link. It was automated, and just low-tech enough that everyone could understand it.Īn RSS feed is simply a specialized subset of XML. So we arrived at the idea of an RSS feed. But that was the extent of their interest in the process they wanted automation to handle the rest. When the investment company released a publication, they made a PDF for print and they were willing to use FTP to place a copy of the PDF on their web server. And since attachments may not make it to a Blackberry something other than email seemed to be needed.

feed reader php script feed reader php script

We considered using broadcast email, but the client wanted something more automatic and less intrusive. The average demographic was male, 50 years old, using a desktop computer, and occasionally a Blackberry. Their constituents are mostly bankers and builders. Probably you would think "Facebook" or "Twitter" but this is an interesting client. I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.














Feed reader php script