I dont understand why this code doesnt work, whenever I run it, it says the session has ended and that I need to reconnect. If you are wondering why im trying to scrape the admin panel is because I want to make a live and easily managable interface to store current bookings.
<?php
$username = 'username';
$password = 'password';
$loginUrl = 'https://admin.booking.com/hotel/hoteladmin/login.html';
$cookie_file_path = "/tmp/cookies.txt";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $loginUrl);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'loginname='.$username.'&password='.$password);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec($ch);
$file = file_get_contents('https://admin.booking.com/hotel/hoteladmin/general/dashboard.html');
print_r($file);
?>
There are no cookie files generated either.