Have a website that i am developing http://www.wheels4rent.net and need help with PHP. when the dates etc and location is entered i have a deep link into another site and i have done this with PHP. This displays cars etc and prices. However i want to have a "book" button in the list_car.php page next to price of cars so that when this is selected it will give customer another page to book but unsure how to do this. The <book> section i have in XML generated from another site and it is CDATA i need to know how to create a button with the CDATA info within as each car will have different CDATA info within the "book" section. Please assist

5 Years
Discussion Span
Last Post by alltech

ok i have the website www.wheels4rent.net/test00.html. when selected pick up locations and date etc...when 'go' is selected the car hire date and car images and cost..etc are present from list_car.php the code as below



function get_data($url)
  $ch = curl_init();
  $timeout = 5;
  $data = curl_exec($ch);
  return $data;
echo get_data($string);

function proxy_url($proxy_url)
    $proxy_name = '';
    $proxy_port = 4001;
    $proxy_cont = '';

    $proxy_fp = fsockopen($proxy_name, $proxy_port);
    if (!$proxy_fp)    {return false;}
    fputs($proxy_fp, "GET $proxy_url HTTP/1.0\r\nHost: $proxy_name\r\n\r\n");
    while(!feof($proxy_fp)) {$proxy_cont .= fread($proxy_fp,4096);}
    $proxy_cont = substr($proxy_cont, strpos($proxy_cont,"\r\n\r\n")+4);
    return $proxy_cont;

echo proxy_url($string);*/

function XML2Array ( $xml , $recursive = false )
    if ( ! $recursive )
        $array = simplexml_load_string ( $xml ) ;
        $array = $xml ;
    $newArray = array () ;
    $array = ( array ) $array ;
    foreach ( $array as $key => $value )
        $value = ( array ) $value ;
        if ( isset ( $value [ 0 ] ) )
            $newArray [ $key ] = trim ( $value [ 0 ] ) ;
            $newArray [ $key ] = XML2Array ( $value , true ) ;
    return $newArray ;

function disp_date($str)
//echo $y."-".$m."-".$d;
return date("M d, Y",strtotime($y."-".$m."-".$d));

$handle = fopen($string, "r");
// If there is something, read and return
if ($handle) {
    while (!feof($handle)) {
        $buffer = fgets($handle, 4096);

//$xmlDoc = new DOMDocument();
$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>&pound;".$car->price."/day</b><br>Unlimited Miles</td></tr>";
echo "</table>";

What i am missing and require is the CDAT which is in the <book> section and for example please see below on different CDATA as i need this info for final booking which will go to thriftys booking page although i still want my logos to appear on my web page if possible. below is info from thrifty but i cannot seem to have a "book now" button and link to final booking page???

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&xpuyear=2011&xpumonth=10&xpuday=10&xputime=09:00&xdbyear=2011&xdbmonth=10&xdbday=12&xdbtime=10:00&xclass=M xclass can be left blank for all, or
M - manual
A - automatic
B - estates and 4x4
P - people carriers
I - minibus
Z - prestige
V - vans and trucks (Heathrow doesn't have these)
X - everything except vans/trucks/minibuses
If xlocdrop is given it should send an appropriate location code (same field codes as used for loccode) eg xlocdrop=UK002
You should use the location call to decide whether this one-way is permitted. ie UK002 should have onewayend=Y
and UK001 should have onewaystart=Y
The xml returns the following formatted reply with a deeplink within the <book> section which jumps in at the quote stage at www.thrifty.co.uk
- <hire>
<locname>HEATHROW AIRPORT</locname>
- <car>
<carimage> http://www.thrifty.co.uk/thrifty/images/carslarge/quotes/312721294241850.jpg </carimage>
<cartype>Full Size</cartype>
<carexample>VW Passat 2.0 5dr CD Player A/C Auxilliary Port - or similar</carexample>
- <book>
- <![CDATA[



This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.