Simple PHP implementation for searching hotels using the Booking.com API through RapidAPI.
This project fetches hotel availability from Booking.com and adds a configurable markup to the prices. It's pretty straightforward - just search by location and dates, get back a list of hotels with pricing.
- PHP 7.4 or higher
- cURL extension enabled
- RapidAPI account with Booking.com API access
- Clone or download this repo
- Copy
.env.exampleto.env - Add your RapidAPI key to the
.envfile
cp .env.example .envEdit .env and set your API key:
RAPID_API_KEY=your_actual_key_here
Using the Booking.com API from RapidAPI: https://rapidapi.com/tipsters/api/booking-com
Two endpoints are used:
/v1/hotels/locations- Find destination IDs/v1/hotels/search- Search for hotels
Do whatever you want with this code.