PHP Classes

How to use it

Recommend this page to a friend!

      PHP OLX Classifieds Scraper  >  All threads  >  How to use it  >  (Un) Subscribe thread alerts  
Subject:How to use it
Summary:how to use olx scraper
Messages:5
Author:Claudia
Date:2015-08-03 21:25:05
 

  1. How to use it   Reply   Report abuse  
Picture of Claudia Claudia - 2015-08-03 21:25:05
Hi there
Please do tell, how to use it. And how can use it for USA and for other categories

  2. Re: How to use it   Reply   Report abuse  
Picture of Rizwan Abbas Rizwan Abbas - 2015-08-05 06:24:47 - In reply to message 1 from Claudia
Please send me your sample categories you want to scrap may be I can create working sample for you.

  3. Re: How to use it   Reply   Report abuse  
Picture of Claudia Claudia - 2015-08-05 11:14:26 - In reply to message 2 from Rizwan Abbas
hi! I am glad and thanks for reply which shows your real professionalism.

About categories:
The same categories as the OLX has on its main page.

Thanks

  4. Re: How to use it   Reply   Report abuse  
Picture of Rizwan Abbas Rizwan Abbas - 2015-08-05 17:14:54 - In reply to message 3 from Claudia
Please download the code and place it in your webroot and then just edit the example.php to run for USA

in the code below change "$category='vehicles'" to your category and remove .pk from the domain.

run it in your browser by entering the http://localhost/example.php


$categories = array('cars','motorcycles','scooters','bicycles','commercial-vehicles','parts-accessories','other-vehicles');
$portal = "olx";
$pages= 2;
$category ="vehicles";
$start = date('h:i:s',time());
for($i=1;$i<=$pages;$i++){
if($i==1){
$searchURL = "http://olx.com.pk/$category/";
}else{
$searchURL = "http://olx.com.pk/$category/?page=".$i;
}

$collection = crawl($searchURL,$portal);
print"<pre>";
print_r($collection);
}

  5. Re: How to use it   Reply   Report abuse  
Picture of Claudia Claudia - 2015-08-29 11:07:05 - In reply to message 4 from Rizwan Abbas
HI Rizwan
The code is not working. THE RESULT ON THE PAGE IS LIKE THIS

olx.com.pk/item/toyota-corolla-gli- ...
Notice: Undefined offset: 1 in /home/XYZ/public_html/1/example.php on line 40
olx.com.pk/item/corolla-altis-2011- ...
Notice: Trying to get property of non-object in /home/XYZ/public_html/1/scraper.php on line 64


AND ON THE SAME PAGE AT THE END

[1] => Array
(
[attributes] => Array
(
[Ref No] => 817406451
[Year] => 2011
[Engine type] => Petrol
[Mileage] => 100000
[Description] => Only one handed use have no fault
[City] => Gujranwala
[Category] => Cars » Toyota
[Manufacturer] =>
)

[carinfo] => Array
(
[price] => 1600000
[Title] =>
[Manufacturer] => Toyota
[Description] => Only one handed use have no fault
[url] => http://olx.com.pk/item/corolla-altis-2011-fully-loaded-and-untouched-IDTjKL1.html#360fcb1fa3
[portal_ad_id] => 817406451
[images] => Array
(
)

[image] =>
[Category] => Cars » Toyota
[Model] => not mentioned
[City] => Gujranwala
)

[adinfo] => Array
(
[source] => olx
[url] => http://olx.com.pk/item/corolla-altis-2011-fully-loaded-and-untouched-IDTjKL1.html#360fcb1fa3
)

[contactinfo] => Array
(
[Cell Number] =>
[Contact Name] => Rana Humza
)

)