A rich site summary feed, its abbreviation RSS is more famous, it is a great example of how XML has a major impact on information consumption. This XML term is a popular format for summarizing information, which is typically, but not specially facing news, including title, summary, authors and release dates. Establishing and assigning RSS feeds becoming increasingly popular, there are several reasons: · Competition: With the continued growth of the number of Web sites competed for customers, the choice of choice for their information to the consumer is always considered in. · Information overload: It is clear that consumers have found them more and more dependent on growing Web sites. That is, the linear navigation method from a site to another has not cut their dependencies. Browse the site summary and do not usually transfer charts, advertisements, and additional foreign materials, is an important way for the minimum investment time and quickly filtering the required information. · Universality: Based on XML-based format clear division of data and expressions, it is easy to convert to widely adapted to different needs of different media distribution (standard web browsers, cell phone, paper, email, etc.). Although the use of RSS feeds has been classified into the elite, they seem to have occurred everywhere. Yahoo!, Christian Science Monitor, CNet News.com, and the BBC have recently available in the WEB site that RSS feeds to their readers. Note: Those readers who are completely unfamiliar with RSS are loaded with Yahoo's technical feed (http: //rss.news.yahoo.com/rss/tech) to your browser in a minute. You can quickly recognize the organization's good data format, which will lend yourself to the expression of the expression, which is a typical thing of XML terminology. For a complete discussion of this topic, you will have a quick search on your favorite search engine; you will find more guidelines more than your keyboard operation. Directory MAGPIE RSS RSS feed MySQL Database PHP Script Conclusion In this article, I will explain how to use PHP, MySQL database servers, and Magpie RSS Parser to provide custom RSS feed services to your web site users. Although I hope that you have at least the basic experience of using PHP and MySQL, but for beginners, examples should be very easy to understand. Because most people in you may not be familiar with Magpie RSS Parser, I will provide some additional information on this important tool. Magpie RSS MAGPIE RSS Parser is created by Kellan Elliott-Mccrea in 2002 to make sure that he perceived does not have a real PHP-based RSS collection solution. As a result, there is an excellent feasible tool that provides a group of useful features, including: • Object-oriented design: object-oriented, modular code allows you to integrate collection features into previous applications . · Extreme configurability: MAGPIE collection and cache behavior can be modified by a good through configuration policy. · Feed cache: This very cool feature can locally cache RSS feed (on the server) to save bandwidth and enhance the performance of the application because it is released under GPL License, so you don't have to save money, as long as you are willing, and The terms and conditions of the license can be free to use this software. It only needs to use XML (Exppat to support new version of PHP (4.0 ). RSS feed let us start from the content of the application. Which type of RSS do you like to provide to your users? Finding RSS feeds seems to be as easy to read your favorite search engine: Just enter "RSS" and some other selection topics such as "Technology," Science, "or" Sports. "And so on.
> ROWID TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
> Title Varchar (150) Not Null,
> URL VARCHAR (150) Not null,
> Primary Key (RowID)
Table 1-1 shows the table content after adding the selected RSS feed:
User Second Table USER stores information about the user using the RSS collector. Each user can only have a unique logo so that we can provide custom services; if so, each user can be tagged with a simple integer value. You need to log in before the user manages his preferred feed and browsses feed, so his email and password will save. For safety, the password can be saved as a unsolvable hash table consisting of 32 characters. In addition, just as the RSS form, in real applications, the user form can become more complicated; however, the necessary part of our collection mechanism can still be found in our form.
Mysql> Create Table User
> ROWID Smallint Unsigned Not Null Auto_Increment,
> Email Varchar (55) Not NULL,
> pswd varchar (32) Not null,
> Primary Key (RowID)
For the simplicity of the example, Table 1-2 shows an example of user information stored in the table: Table 1-2: User Information Example
User_to_rss_feed Third Table User_to_RSS_FEED, link the user with the RSS feeds they choose. This form has two columns: UserID and RSSID. UserID tag users; RSSID tag RSS feed.
MySQL> CREATE TABLE USER_TO_RSS_FEED (> Userid Smallint Unsigned Not Null Auto_Increment,
> rsSID tinyint unsigned not null
Table 1-3 provides analog of the form of content after our users have selected their favorite feed. Table 1-3: User / RSS feed mapping
The last task of the PHP script is to create a script that displays the RSS feed selected by the user. The title of this script is myrss.php, and he is incredible, only two main components: · login: The user needs to log in to browse his custom feed. This can be completed by using a simple table and some confirmation of the email address and password logic. · RSS AGGREGATION AND DELIVERY: If a valid login (or a valid session; see next), we will use the Magpie RSS Parser to display the RSS feed selected by the user. To avoid user complaints to log in every time you need RSS "FIX," and I use PHP's session period processing feature. Once successful login, the user's unique flag is stored as a session period to be retrieved later. Remember, the storage period is completely dependent on how you configure your PHP installation session period feature. Listings 1-1 and 1-2 provide annotation code for both components. Both components are equipped with and can be used to browse, and the browsing feature can be implemented by setting a link at the end of Listing 1-2. Listing 1-1: Login component
// Start or Continue a session
// HAS THE User
IF (! isset ($ _ session ['userid']))
IF (! isset ($ _ post ['email'])))