Recommend this page to a friend! |
![]() ![]() |
Info | ![]() |
![]() |
![]() ![]() |
Reputation | Support forum (6) | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
![]() ![]() ![]() ![]() | Total: 5,522 | All time: 442 This week: 216![]() |
Version | License | Categories | ||||
htmlsql 1.0.0 | BSD License | HTML, Text processing |
Description | Author | |||||||||||||||||||||||||
This class can be used to parse and extract information from HTML documents using a query language similar to SQL to define the information to be extracted. Innovation Award
|
|
htmlSQL - Version 0.5 - README --------------------------------------------------------------------- AUTHOR: Jonas John (http://www.jonasjohn.de/) DESCRIPTION: --------------------------------------------------------------------- htmlSQL is a experimental PHP class which allows you to access HTML values by an SQL like syntax. This means that you don't have to write complex functions (regular expressions) to extract specific values. The htmlSQL queries look like this: SELECT href,title FROM a WHERE $class == "list" ^ Attributes ^ ^ search query (can be empty) to return ^ ^ HTML tag to search in "*" is possible = all tags This query returns an array with all links that contain the attribute class="list". All web transfers in htmlSQL are using the awesome Snoopy class (package version 1.2.3 - URL: http://snoopy.sourceforge.net/) But for file or string queries Snoopy is not required. You find all Snoopy related documents (copyright, readme, etc) in the snoopy_data/ folder. HOW TO USE: --------------------------------------------------------------------- Just include the "snoopy.class.php" and the "htmlsql.class.php" files into your PHP scripts and look at the examples (examples/) to get an idea of how to use the htmlSQL class. It should be very simple :-) BACKGROUND / IDEA: --------------------------------------------------------------------- I had this idea while extracting some data from a website. As I realized that the algorithms and functions to extract links and other tags are often the same - I had the idea to combine all functions to an universal usable class. While drinking a coffee and thinking on that problem, I thought it would be cool to access HTML elements by using SQL. So I started creating this class... WARNING: --------------------------------------------------------------------- The eval() function is used for the WHERE statement. Make sure that all user data is checked and filtered against malicious PHP code. Never trust user input! TODO: --------------------------------------------------------------------- - enhance the HTML parser - test htmlSQL with invalid and bad HTML files - replace the ugly eval() method for the WHERE statement with an own method - more error checks - include the LIMIT function/method like in SQL LICENSE: --------------------------------------------------------------------- htmlSQL uses a modified BSD license, you find the full license text in the "htmlsql.class.php". |
Screenshots | ||
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() ![]() |
Class | Contains the main htmlSQL class | ||
![]() ![]() |
Class | The famous snoopy class by Monte Ohrt - v1.01 | ||
![]() ![]() |
Doc. | English readme with description and todo list | ||
![]() ![]() |
Doc. | The same as the readme.txt just in german language |
![]() |
/ | examples |
File | Role | Description |
---|---|---|
![]() ![]() |
Example | Example 1 - Shows a simple query |
![]() ![]() |
Example | Example 2 - Shows a simple query and the "href as url" usage |
![]() ![]() |
Example | Example 3 - Shows how to connect to a file and a simple query |
![]() ![]() |
Example | Examples 4 - Shows a advanced query with preg_match |
![]() ![]() |
Example | Example 5 - Shows a advanced query (with substr) |
![]() ![]() |
Example | Example 6 - Show how to connect to a string |
![]() ![]() |
Example | Example 7 - Shows a complex query |
![]() ![]() |
Example | Example 8 - Shows how to parse a RSS/XML file with htmlSQL |
![]() ![]() |
Example | Example 9 - Shows how to use the "select" function |
![]() ![]() |
Example | Example 10 - Shows how to use the "isolate_content" function |
![]() ![]() |
Example | Example 11 - Shows how to query a simple XML file |
![]() ![]() |
Example | Example 12 - Shows how to replace the user agent and the referer with custom values |
![]() ![]() |
Example | Demo HTML data (used for parsing examples) |
![]() ![]() |
Example | Example XML file (to test parsing) |
![]() ![]() |
Doc. | Some query examples for copy and paste |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
0% |
|
|
User Ratings | User Comments (4) | |||||||||||||||||||||||||||||||||||||||||||
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.
Related pages |
A detailed htmlSQL description A detailed htmlSQL description |
htmlSQL live demo Test the htmlSQL class... |
Pages that reference this package |
HTML SQL » Burak Kanmaz 3-4 yildir ben bir web sayfasinin icerigini analiz edecek bir web sayfasi yapmayi hayal etmisimdir hep... |
Navegar un pagina en HTML con querys en SQL. HTML_SQL es el nombre de una clase en PHP que nos permite navagar una pagina en HTML, con querys hechos en SQL. La clase ha ganado el segundo lugar de los premios de innovación en PHPClasses. Esto es sin duda, un avance interesante. Se le podran dar habilidades extras a los frameworks MVC. Algunos ejemplos en el enlace. Saludos |