How shafihuzaib/hfeeds works
Project type and purpose
• This is a small PHP-based web application (“hFeeds”) that generates RSS feeds for arbitrary web pages by letting a user define “global” and “repeatable” HTML extraction patterns.
• There is no separate database: all generated feeds live as PHP-wrapped XML files under the xml/ directory with an .htaccess that tells Apache (or another server) to treat .xml as PHP.
File structure
• Top-level scripts:
• index.php – initial form for the page URL and encoding
• pattern.php – displays the source and lets users pick global/repeatable patterns
• prepat.php – takes the pattern selections plus feed-metadata and generates the final feed file
• header.php / style.css / images/ – shared UI elements and styling
• Configuration & dependencies:
• .gitignore, TODO.txt, README.md, app.json, NetBeans project files under nbproject/
• The xml/ folder holds the generated feeds. It contains an .htaccess that maps .xml to the PHP engine and two template files (default.php and include.php) that build each feed.
README for additional insights
• There is no database layer; feed definitions and generated items are entirely file-based.
• Users walk through 3 steps (enter URL, define patterns, set feed fields) before the app spits out a live RSS feed link in xml/XYZ.xml.
a. Main components
• Client (Web Browser)
• Web Server (e.g., Apache/Nginx) with PHP handler
• PHP application layers:
– UI layer (index.php → pattern.php → prepat.php)
– Extraction engine (pattern parsing, HTML scraping code embedded in these scripts)
• File Storage: the xml/ directory (generated RSS feed files)
• External Systems: Target Web Pages (the URL the user enters) and RSS Consumers (feed readers)
b. Relationships & data flow
1. Browser → HTTP GET/POST → index.php
2. index.php → shows form → user submits → pattern.php
3. pattern.php → HTML scrape of target URL → user selects patterns → submits to prepat.php
4. prepat.php → writes out an .xml PHP file into xml/
5. Browser/RSS reader → requests xml/XYZ.xml → .htaccess routes to PHP → serves RSS XML
c. Architectural patterns & principles
• Single-page stepwise UI (wizard style)
• File-based persistence (no DB)
• Separation of concerns between UI (header.php/style.css), pattern logic, and feed template (xml/*.php)
d. Key technologies & libraries
• PHP 7+ (built-in DOM functions or regex for scraping)
• Apache .htaccess for extension mapping
• Composer (optional) for any future library additions