#!/usr/bin/env php getTimestamp(); } else { $from=time(); } if ($to) { $to=New DateTime($to); $to=$to->getTimestamp(); } else { $to=time()+3600; } $bookedapiclient = new bookedapiclient(getenv("username"), getenv("password")); $bookedapiclient-> authenticate(); $reservations=$bookedapiclient->getReservation(null,null,null,date("c",$from),date("c",$to)); $cnt=0; foreach ($reservations["reservations"] as $r) { $start=New DateTime($r["startDate"]); $start->setTimezone(New DateTimeZone(getenv("timezone"))); $end=New DateTime($r["endDate"]); $end->setTimezone(New DateTimeZone(getenv("timezone"))); $sstart=$start->getTimestamp(); $send=$end->getTimestamp(); if ($sstart>=$from && $send<=$to) { $cnt++; } } echo $cnt;