I have following website URL which is http://www.wheels4rent.net/test00.html
When data is entered a PHP is generated from XML and example given below of XML
You can get a quotation with a call like this: location UK001 (Heathrow) 10/10/2011 09:00 - 12/10/2011 10:00 Manual cars only
http://www.thrifty.co.uk/cgi-bin/gen5?runprog=thxml&xsrc=7qhfqou3&mode=quote&xloc=UK001&
amp;xpuyear=2011&xpumonth=10&xpuday=10&xputime=
09:00&xdbyear=2011&xdbmonth=10&xdbday=12&xdbtime=10:00&
xclass=M
This will give a list of cars at the specified location and i have done this ok using php. You can see result from www.wheels4rent.net/test00.html and put in location and date.
From this one can retrieve data from list_car.php when 'go' button clicked.list_car.php is shown below.
<?php
$string="http://www.thrifty.co.uk/cgi-bin/gen5?runprog=thxml&xsrc=7qhfqou3&mode=quote";
$string.="&xloc=".$_REQUEST["loccode"];
$string.="&xpuyear=".substr($_REQUEST["pu_month"],0,4);
$string.="&xpumonth=".substr($_REQUEST["pu_month"],4);
$string.="&xpuday=".$_REQUEST["pu_day"];
$string.="&xputime=".$_REQUEST["pu_time"];
$string.="&xdbyear=".substr($_REQUEST["db_month"],0,4);
$string.="&xdbmonth=".substr($_REQUEST["db_month"],4);
$string.="&xdbday=".$_REQUEST["db_day"];
$string.="&xdbtime=".$_REQUEST["db_time"];
$string.="&xclass=".$_REQUEST["vehicle_type"];
function XML2Array ( $xml , $recursive = false )
{
if ( ! $recursive )
{
$array = simplexml_load_string ( $xml ) ;
}
else
{
$array = $xml ;
}
$newArray = array () ;
$array = ( array ) $array ;
foreach ( $array as $key => $value )
{
$value = ( array ) $value ;
if ( isset ( $value [ 0 ] ) )
{
$newArray [ $key ] = trim ( $value [ 0 ] ) ;
}
else
{
$newArray [ $key ] = XML2Array ( $value , true ) ;
}
}
return $newArray ;
}
function disp_date($str)
{
$y=substr($str,0,4);
$m=substr($str,4,2);
$d=substr($str,6,2);
return date("M d, Y",strtotime($y."-".$m."-".$d));
}
$handle = fopen($string, "r");
$xml_string="";
if ($handle) {
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
$xml_string.=$buffer;
}
fclose($handle);
}
$xmlDoc=simplexml_load_string ( $xml_string ) ;
echo "Zipcode: ".$xmlDoc->hire->loccode."<br>Location Name: ".$xmlDoc->hire->locname."<br>Pickup Time: ".disp_date($xmlDoc->hire->pickupdate)." ".$xmlDoc->hire->pickuptime."<br>Dropback Time: ".disp_date($xmlDoc->hire->dropbackdate)." ".$xmlDoc->hire->dropbacktime."<br>";
echo "<table border=1 style='font:12px verdana' cellspacing=0 cellpadding=3><tr><td>Car Type</td><td>Description</td><td>Rate</td></tr>";
foreach($xmlDoc->car as $car)
{
echo "<tr><td width=150px><img src='".$car->carimage."' align='right' style='padding:5px; width:64px'><b>".$car->cartype."</b><br>".$car->carsipp."<br>".$car->transmission."</td><td><b>".$car->carexample."</b></td><td><b>£".$car->price."/day</b><br>Unlimited Miles</td></tr>";
}
echo "</table>";
?>
From the http://www.wheels4rent.net/list_car.php i have all the required info except a booking button which i require and when a particular car is booked then the CDATA info is given but unsure how to integrate the CDATA at present. Any pointers would be appreciated. The CDATA info is in the <book> section of the XML(click on 1st link given to view)
Andrew