PHP code example of mahedimaruf / bikroy

1. Go to this page and download the library: Download mahedimaruf/bikroy library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mahedimaruf / bikroy example snippets




// import goutte
use Goutte\Client;

// Create new goutte client
$bot = new Client();

//Initialize a Instance "bikroy" class
$bikroy = new Mahedimaruf\Bikroy($bot);
$city = 'dhaka';

// Pass the city to start_page method.It will return the first ad list page link to start scraping
$nextlink = $bikroy->start_page($city);
while ($nextlink) {

//Pass page link. It will return an array with all the name and phone numbers from the ad list page and a link to next page.
    $results = $bikroy->scrap($nextlink);
    var_dump($results['details']);
		
//Set next page link. So script will continue scraping until there is no next link!
    $nextlink = $results['nextlink'];
}