Hi
I am having my first stab at curl and am having some difficulties.
I would like to get prices from here:
http://webbookings.four-pillars.co.uk/tortworth/
Once I have selected my dates and numbers I get to a second page to select a package.
I am trying for 8th October 2011 for 1 night with 2 adults.
On the second page I have chosen the bed and breakfast but I do want to extend this to collect from all of the available options.
The next page has the prices for each of the room types. This is the page I would like to scrape.
The code I have is always dropping me back to the first page.
Could anyone let me know where I am going wrong please?
$TargetUrl = "https://webbookings.four-pillars.co.uk/tortworth/Availability.asp?WCI=Reservations&V1WebSession=59539";
$userAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1";
$PostInformation['Package'] = "WEB";
$PostInformation['Pick'] = "";
$PostInformation['FileNum'] = "";
$PostInformation['ArvDate'] = "10/08/2011";
$PostInformation['DepDate'] = "10/09/2011";
$PostInformation['iRooms'] = "1";
$PostInformation['iAdults'] ="2";
$PostInformation['iYouths'] ="0";
$PostInformation['iChildren'] ="0";
$PostInformation['iChild1'] ="0";
$PostInformation['iChild2'] ="0";
$ch = curl_init($TargetUrl);
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $PostInformation);
$html = curl_exec($ch);
if (!$html) {
echo "
cURL error number:" .curl_errno($ch);
echo "
cURL error:" . curl_error($ch);
exit;
}else{
echo $html;
}
curl_close($ch);