MarioFlores/bookingcom

从booking.com抓取房源信息

dev-master 2017-10-18 15:40 UTC

This package is not auto-updated.

Last update: 2024-09-29 02:49:46 UTC


README

Bookingcom scrape 是一个工具,用于收集知名网站 booking.com 上的房源信息

使用 composer 安装

"require": { "marioflores/bookingcom": "dev-master" }}

use MarioFlores\Bookingcom\Bookingcom; 

$booking = new Bookingcom;

/**
 * Get the first search result page
 * 
 * use parameters from original url on booking.com site 
 * 
 * search('dest_id', 'dest_type') 
 */

$first_search_results = $booking->search('3343', 'region');  

//fetch all individual hotel links form serach result 

$all_links = $booking->listAllHotels($first_search_results); 

var_dump($all_links); 

//fetch data from one hotel using link 

$hotel = $booking->getHotel($all_links[0]); 

//fetch url of photos 

$photos = $booking->getPhotos($all_links[0]); 

//fetch price 

$price = $booking->getPrice($all_links[0]);