Expand|Select|Wrap|Line Numbers
- Thanks for this but cannot seem to make this work. When i do i just get the URL string listed on the webpage?. Here is the list_car1.php file.
- var timeout;
- function checkLoccode(sobj) {
- if (sobj.options[sobj.selectedIndex].value=='--other countries--') {
- //getUrl('GET', 'http://' + location.host + '/cgi-bin/gen5?runprog=thajaxlog&log=prepaid_from_home', true, ajaxLogCallBack);
- timeout=setTimeout("callRedirect()",3000);
- }
- }
- function ajaxLogCallBack() {
- if (requestObject.readyState == 4) {
- if (requestObject.status==200) {
- clearTimeout(timeout);
- callRedirect();
- }
- }
- }
- function callRedirect() {
- location.href='http://worldwide.thrifty.com';
- }
- function GetXmlHttpObject()
- {
- var xmlHttp1=null;
- try
- {
- // Firefox, Opera 8.0+, Safari
- xmlHttp1=new XMLHttpRequest();
- }
- catch (e)
- {
- // Internet Explorer
- try
- {
- xmlHttp1=new ActiveXObject("Msxml2.XMLHTTP");
- }
- catch (e)
- {
- xmlHttp1=new ActiveXObject("Microsoft.XMLHTTP");
- }
- }
- return xmlHttp1;
- }
- function submit_form()
- {
- var url;
- url="http://www.thrifty.co.uk/cgi-bin/gen5?runprog=thxml&xsrc=7qhfqou3&mode=quote";
- url+="&xloc="+document.xmlcnt.loccode.value;
- url+="&xlocdrop="+document.xmlcnt.locdrop.value;
- url+="&xonewaystart="+document.xmlcnt.onewaystart.value;
- url+="&xonewayend="+document.xmlcnt.onewayend.value;
- url+="&xbook="+document.xmlcnt.book.value;
- url+="&xpuyear="+(document.xmlcnt.pu_month.value).substr(0,4);
- url+="&xpumonth="+(document.xmlcnt.pu_month.value).substr(4);
- url+="&xpuday="+document.xmlcnt.pu_day.value;
- url+="&xputime="+document.xmlcnt.pu_time.value;
- url+="&xdbyear="+(document.xmlcnt.db_month.value).substr(0,4);
- url+="&xdbmonth="+(document.xmlcnt.db_month.value).substr(4);
- url+="&xdbday="+document.xmlcnt.db_day.value;
- url+="&xdbtime="+document.xmlcnt.db_time.value;
- url+="&xclass="+document.xmlcnt.vehicle_type.value;
- url+="&randval="+Math.random();
- //url="http://www.google.com"
- xmlHttp1=GetXmlHttpObject();
- if (xmlHttp1==null)
- {
- alert ("Your browser does not support AJAX!");
- return;
- }
- xmlHttp1.onreadystatechange=function()
- {
- if(xmlHttp1.readyState==4)
- {
- document.xmlcnt.xmlsrc.value=xmlHttp1.responseText;
- document.xmlcnt.submit();
- }
- }
- xmlHttp1.open("GET",url,true);
- xmlHttp1.send(null);
- }
- </script>
- <?php
- //ini_set("disable_functions",null);
- //phpinfo();
- $string="http://www.thrifty.co.uk/cgi-bin/gen5?runprog=thxml&xsrc=7qhfqou3&mode=quote";
- $string.="&xloc=".$_REQUEST["loccode"];
- $string.="&xlocdrop=".$_REQUEST["locdrop"];
- $string.="&xbook=".$_REQUEST["book"];
- $string.="&xonewaystart=".$_REQUEST["onewaystart"];
- $string.="&xonewayend=".$_REQUEST["onewayend"];
- $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 get_data($url)
- {
- $ch = curl_init();
- $timeout = 5;
- curl_setopt($ch,CURLOPT_URL,$url);
- curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
- curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
- $data = curl_exec($ch);
- curl_close($ch);
- return $data;
- }
- echo get_data($string);
- function proxy_url($proxy_url)
- {
- $proxy_name = '127.0.0.1';
- $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);}
- fclose($proxy_fp);
- $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 ) ;
- }
- 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);
- //echo $y."-".$m."-".$d;
- return date("M d, Y",strtotime($y."-".$m."-".$d));
- }
- $handle = fopen($string, "r");
- $xml_string="";
- // If there is something, read and return
- if ($handle) {
- while (!feof($handle)) {
- $buffer = fgets($handle, 4096);
- $xml_string.=$buffer;
- }
- fclose($handle);
- }
- //$xmlDoc = new DOMDocument();
- $xmlDoc=simplexml_load_string ( $xml_string ) ;
- ?>
- <?
- //print_r($xmlDoc);
- echo "<br><strong/>Pick up Location: ".$xmlDoc->hire->locname."<br> Drop-off Location: ".$xmlDoc->hire->locdrop."<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=200px><img src='".$car->carimage."' align='right' style='padding:1px; width:100px'><b>".$car->cartype."</b><br>".$car->carsipp."<br>".$car->transmission."</td><td><b>".$car->carexample."</b></td><td><b>£".$car->price."
- </b><br>Unlimited Miles</b><br><input type='submit' name='Book' value='Book'><br>".$url = (string)$car->book."</br></b></td></tr>";
- echo "</form>";
- echo "<form method='post' action='book1.php'>";
- }
- echo "</table>";
- ?>
- </span>
- </p>
- </p>
- <p> </p>
- <p> <span class="row1"><div class="separate"></div>
- </span></p>