Home > PHP > Booking Calendar Scraper

Booking Calendar Scraper

December 6th, 2009

Hello,

We need to create a PHP function, that we will plug into our existing real estate reservation website.
The function should retrieve a booking calendar from an external website, parse the HTML to find out which dates are booked (unavailable), and return the ranges of the booked dates.

Here is the detailed description how the function should work:

1. The following arguments will be passed to the function:
– property id,
– start date
– end date.
Both dates are in YYYY-MM-DD format.

2. The function has to retrieve the calendar from the following specific URL:
http://www.newyorkstay.com/apartments-rent/reservation.php?apartmentId=XX
where XX in the property id passed to the function.
We will use id=134 for test, thus the calendar url will be
http://www.newyorkstay.com/apartments-rent/reservation.php?apartmentId=134

3. Need to process the calendar, and find out the date ranges when the property is booked (brown dates on the calendar page).
The return of the function must be an array of booked date range entries, (start=>YYYY-MM-DD,end=>YYYY-MM-DD) for each booked range. The booked ranges are to be returned only within the start-end date range passed to the function. If there are no bookings within the start-end range – return an empty array.
If the calendar cannot be retrieved or parsed – return NULL.

The calendar is shown for 1 year from the current month by default. Remember, we need to retrieve the calendar for specific date range. Need to add some fields to the URL, same as the date selector at the top does.
If the date range exceeds 1 year, probably need to request the calendar more than once for different years.

The calendar HTML structure is expected to be as in the URL mentioned above. You should rely on same structure and class names, but it would be nice if we allow some flexibility.

We do not need any front-end or design, this function will be integrated to existing site. We’ll provide the dev environment with FTP access.

This task is just a small piece of a large development project. If you get this job done right, we would like to continue working with you, we have a lot more stuff to do.

Feel free to ask any questions. You may contact me directly on Yahoo IM or Skype ‘CommerceByte’ either, or MSN commercebyte@live.com

Thank you for your considerations.
Jim

P.S. We’re looking for a single developer. Development firms please DO NOT apply.

(Just in case, if you feel uncomfortable about scraping another site, dont worry about that, i have a direct arrangement with newyorkstay.com’s owner)


Booking Calendar Scraper

Categories: PHP Tags: , , , , , ,
Comments are closed.
Bear