I am trying to use PHP
to grap some information from the webpage. I have found recommendations to use htmlSQL
which makes easy to get specific value from HTML. I have read all the examples coming with it, hovewer, I've got a very simple issue. When I execute my script, the output shows
PHP Fatal error: Class 'htmlsql' not found in /home/jeff/htmlsql2.php on line 5
I have downloaded the htmlsql.class.php
document from the website and put it in the HOME. could anyone can help me fix this issue?
The following is my code. In this case I want to get the all product names from the web page.
<?php
//using htmlSQL to scrap the web, reference url http://www.devquotes.com/2010/12/07/seo-scraping-with-websql/
include_once("htmlsql.class.php");
//create new htmlsql and link the web
$wsql = new htmlsql();
if (!$wsql->connect('url','http://m.dicksmith.com.au/#/Product/Search?query=IPOD')){
print 'Error while connecting:' . $wsql->error;
exit;
}
//limit range
$wsql->isolate_content('<div class="productItemInner">', '</div>');
//try to fetch
if(!$wsql->query('SELECT * FROM p WHERE $class=="blueFont largeFont"')){
print "Query error:".$wsql->error;
exit;
}
foreach($wsql->fetch_array() as $row){
print_r($row);
}
?>