xml| statement
A Super cow PHP class that was discovered today from Phpclasses.org, the most special of which is that you can use SELECT statements to read specific data from XML and HTML documents. For example, here is an example:
<?php
/*
* * Htmlsql-example 1
**
* * A simple example of a query
*/
Include class file
Include_once (".. /snoopy.class.php ");
Include_once (".. /htmlsql.class.php ");
Creating objects
$wsql = new Htmlsql ();
URL on connection
if (! $wsql->connect (' url ', '/')) {
print ' Error while connecting: '. $wsql->error;
Exit
}
/* Execute Query
SELECT * from a reads all the <a> tags in the HTML of the phpchina.cn home page
*/
if (! $wsql->query (' SELECT * from a ')) {
Print "Query error:". $wsql->error;
Exit
}
Output results:
foreach ($wsql->fetch_array () as $row) {
Print_r ($row);
/*
$row is an array like the following:
Array (
[href] =>/index.html
[TagName] => A
[Text] => Home
)
*/
}
?>
Author of this class: Jonas John
Personal homepage: http://www.jonasjohn.de/
Age: 20