mahedimaruf/bikroy

一个用于从bikroy.com抓取电话号码的PHP库

1.0 2018-02-06 23:38 UTC

This package is not auto-updated.

Last update: 2024-09-22 15:12:54 UTC


README

要求

PHP版本5.4.0或更高

使用composer安装

还可以通过composer安装库

composer require mahedimaruf/bikroy

示例用法

require_once 'vendor/autoload.php';

// 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'];
}

享受吧。但不要过度使用