request('GET', $url);// Locate the element containing the arrival data
// You may need to inspect the website to find the specific elements
$arrivalData = $crawler->filter('.table-otopeni tr');// Loop through the rows in the arrival table
$arrivalData->each(function ($row) {
$columns = $row->filter('td');if ($columns->count() >= 4) {
$flightNumber = $columns->eq(0)->text();
$origin = $columns->eq(1)->text();
$scheduledArrivalTime = $columns->eq(2)->text();
$status = $columns->eq(3)->text();// Output the arrival information
echo "Flight Number: $flightNumber, Origin: $origin, Scheduled Arrival Time: $scheduledArrivalTime, Status: $status" . PHP_EOL;
}
});
} catch (Exception $e) {
echo 'An error occurred: ' . $e->getMessage();
}