Dubizzle is an online classifieds website. This project aims to become a simple and complete PHP scraping-based API for Dubizzle.
This project was enspired by python's Dubizzle scraping API.
This is still a work in progress. There is much left to do until this becomes what it should be. I will however make sure that the master branch functions as expected. Any help would be greatly appreciated, obviously.
Another thing to point out is that the main focus for the time being is on Dubizzle UAE and specifically Motors search within it.
- php-html-parse
- php-curl-class
- HTMLPurifier
- PHP 5.3 or greater
To easily install Dubizzle, simply:
composer require osoobe/dubizzleIf you don't have compose install, see how to install and use composer
use Dubizzle\Search;
$params = ["country"=>'uae', "city"=>"dubai", "section"=>"motor"];
$uea = new Search($params);
$query = $uea->search();
$query->fetch();
$results = $query->get_results();The $results variable is a array of associated data for each result item on dubizzle:
var_dump($results);
[
['title' => '...',
'location' => '...',
'url' => '...',
'price' => '...',
'category' => '...'
],
['title' => '...',
'location' => '...',
'url' => '...',
'price' => '...',
'category' => '...'
],
...
]See Demo 1 for data output.
Find average price of year 2007 and above Nissan Altimas in Dubai (Live Demo)
require_once "../vendor/autoload.php";
use Dubizzle\Search;
$params = [
"keyword"=>'altima',
"country"=>'uae',
"city"=>'dubai',
"section"=>'motors',
"category"=>'cars',
"make"=>'nissan',
"min_year"=>2007,
"num_results"=>'all'];
$uae = new Search($params);
$query = $uae->search();
$query->fetch();
$results = $query->get_results();
$result_count = count($results);
$total_price = 0;
foreach($results as $result){
$total_price += $result["price"];
}
echo "Num. Results: ".$result_count;
echo "<br/>";
echo "<br/>";
echo "Average price: ".(intval($total_price / $result_count)); # Prints 39239.94Get the list of makes from [Dubizzle] (Live Demo):
use Dubizzle\Category;
$category = new Category();
$makes = $category->get_makes(Category::$uae["categories"]["options"]['cars']);Get the list of models from [Dubizzle] (Live Demo):
use Dubizzle\Category;
$category = new Category();
$models = $category->get_models(Category::$uae["makes"]["options"]['audi']);country- string; defaults to 'uae'keyword- stringcity- stringsection- stringmin_priceandmax_price- integerscategory- stringadded_days- choices are 0, 3, 7, 14, 30, 90, or 180num_results- integer; 'all' fetches all results availabledetailed(not implemented) - if set toTrue, fetches full listing data for each result; slower, obviously
make- a long list can be found inregions.pymin_yearandmax_year- integersmin_kmsandmax_kms- integersseller- 'dealer' or 'owner'fuel- 'gasoline', 'hybrid', 'diesel', or 'electric'cylinders- 3, 4, 5, 6, 8, 10, or 12transmission- 'automatic' or 'manual'
url- string, requiredcountry- string; defaults to 'uae'
Please use the Issues page for that.