Jump to content

oracle765

Members
  • Posts

    219
  • Joined

  • Last visited

Posts posted by oracle765

  1. <?php
    require_once('config/config.php');
    require_once('files/hotel_form_check.php');
    $hotel_id = $_GET['hotel_id'];
    $currency_code = $_GET['currency_code'];
    $pr = $_GET['price'];
    if($pr!="")
    {
        $h_price = $currency_code." ".$pr ;
    }
    $u = urldecode($_GET["q"]);
    $n_url = str_replace("'","",$u);
    
    
    $store_url = "http".$n_url ;
    
    $timestamp = gmdate('U');
    $secret = 'NOT-SHOWN';
    $apiKey = 'TEST';
    $cid = 'HIDDEN';
    $sig = md5($apiKey . $secret . $timestamp);
    
    $url2 = 'http://api.ean.com/ean-services/rs/hotel/v3/info?minorRev=26';
    $url2 .='&apiKey='.$apiKey.'';
    $url2 .='&cid='.$cid.'&sig='.$sig.'';
    $url2 .='&currencyCode='.$currency_code.'&hotelId='.$hotel_id.'';
    $header[] = "Accept: application/json";
    $header[] = "Accept-Encoding: gzip";
    $ch3 = curl_init();
    curl_setopt( $ch3, CURLOPT_HTTPHEADER, $header );
    curl_setopt($ch3,CURLOPT_ENCODING , "gzip");
    curl_setopt($ch3, CURLOPT_CUSTOMREQUEST, 'GET');
    curl_setopt( $ch3, CURLOPT_URL, $url2 );
    curl_setopt( $ch3, CURLOPT_RETURNTRANSFER, true );
    $respon = json_decode(curl_exec($ch3), true);
    //
    //echo "<pre>";
    //print_r($respon);
    //exit();
    
    $res = "select * from CountryList where `CountryCode` = '".$respon['HotelInformationResponse']['HotelSummary']['countryCode']."' limit 1";
    $sql=mysql_query($res);
    $row=mysql_fetch_array($sql);
    $country_name = $row['CountryName'];
    
    
    
    //SEO TITLES AND META DESC //
    $title_tag = $respon['HotelInformationResponse']['HotelSummary']['name'] ;
    $city_country_tag = $respon['HotelInformationResponse']['HotelSummary']['city']; 
    
    $title .=  $title_tag. " - " .$city_country_tag;
    //$title .= " | Compare & Choose";
    
    $check_header_length = strlen($title);
    
    if($check_header_length >= 35)
    {
    $title = $title;
    }
    
    elseif($check_header_length <= 35)
    {
    $title .= " | Compare & Choose";;
    }
    //<link href="//www.compareandchoose.com.au/hotel_details.php?cntry=' . $cntry . '&cntryname=' . $cn . '&city=' . str_replace(" ", "%20", $city1) . '" rel="canonical" />
    //
    $meta = '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <meta name="description" content="'.$title_tag.'. Compare and Choose cheap hotel stays. '.$city_country_tag. " " .$country_name.' accomodation compared." />
    <!-- MICROFORMATS FOR GPLUS -->
    <link href="https://plus.google.com/+CompareandchooseAuTravel/posts" rel="publisher" />
    <meta itemprop="name" content="' .$title. '">
    <meta itemprop="description" content="'.$title_tag.'. Compare and Choose cheap hotel stays. '.$city_country_tag. " " .$country_name.' accomodation compared.">
    
    <meta property="og:locale" content="en_US" />
    <meta property="og:type" content="website" />
    <meta property="og:title" content="' .$title. '" />
    <meta property="og:description" content="'.$title_tag.'. Compare and Choose cheap hotel stays. '.$city_country_tag. " " .$country_name.' accomodation compared." />
    <meta property="og:url" content="http://www.compareandchoose.com.au/" />
    <meta property="og:site_name" content="Compare and Choose" />
    <meta property="article:publisher" content="https://www.facebook.com/compareandchoose" />
    <meta property="fb:app_id" content="1386609318277530" />
    <meta property="og:image" content="http://www.compareandchoose.com.au/images/Compare-and-Choose-logo.png" />
    <meta property="og:image:width" content="313" />
    <meta property="og:image:height" content="75" />';
    
    $part = new Body();
    $head = $part->getHead($title,$meta);
    $header = $part->getHeader('Hotel');
    $footer = $part->getFooter();
    echo $head;
    echo $header;
    ?>
    <script type="text/javascript">
    	div = {
    		show: function(elem) {
    			document.getElementById(elem).style.visibility = 'visible';
    		},
    		hide: function(elem) {
    			document.getElementById(elem).style.visibility = 'hidden';
    		}
    	}
    </script>
    <link rel="stylesheet" type="text/css" href="css/elastislide.css" />
    <script src="js/modernizr.custom.17475.js"></script>
    <div class="overlay_wrap" style="display: none;"></div>
                         <div class="loader_hotel_page" style="display: none;"><img src="<?php echo SITE_URL; ?>images/search-loader.gif" alt="searching-records"/></div>
    <div class="container">
    <div class="listing">
     
            <div class="row">
            <div class="col-xs-12 col-md-3 col-lg-3">
              <div class="refine-search for-button">
                 <h1>Compare Hotel Prices</h1>
                 <?php require_once('files/hotel_list_page_form.php'); ?>
              </div>
            </div>
            <div class="col-xs-12 col-md-9 col-lg-9">
                    <div class="page-title">
                    <h1><?php echo $respon['HotelInformationResponse']['HotelSummary']['name'] ;?></h1>
                    <div class="details_rating">
                     <?php
                            $rate = $respon['HotelInformationResponse']['HotelSummary']['hotelRating'];
                            $f= floor($rate);
                            $c = ceil($rate);
                            if($rate!="" && $rate!=0)
                            {
                              for($in = 1; $in<=$rate ;$in++)
                              { ?>
                                <img src="images/star.png" alt="star-rating">
                        <?php }
                              if($f != $c)
                              {?>
                                 <img src="images/star_half.png" alt="half-star-rating">
                       <?php }
                              
                            }                                    
                        ?>       
                    </div>
                    <div class="c1"></div>
                    <p class="stay"><?php echo $respon['HotelInformationResponse']['HotelSummary']['address1']." , ";echo $respon['HotelInformationResponse']['HotelSummary']['city']." , " ; echo $country_name; ?></p>
                  </div>
                <div class="row dtlsGalleryPan">
                <div  class="col-xs-12 col-md-6 col-lg-6 galImgDiv">
            <div class="gallery">
                    <div class="image-preview">
                    <?php if($respon['HotelInformationResponse']['HotelImages']['HotelImage'][0]['url'] != "") { ?>
                    <img id="preview" src="<?php echo  $respon['HotelInformationResponse']['HotelImages']['HotelImage'][0]['url'] ;?>" alt="image-display" />
                    <?php } else {?>
                    <img id="preview" src="images/no_img.gif" alt="preview-image" width="350" height="250" />
                    <?php } ?>
                    </div>
                    <!-- Elastislide Carousel -->
                   <ul id="carousel" class="elastislide-list">
                   <!--<ul >-->
                    <?php
                    if($respon['HotelInformationResponse']['HotelImages']['HotelImage'] !="")
                    {
                    $i= 0;
                    foreach($respon['HotelInformationResponse']['HotelImages']['HotelImage'] as $img)
                    {
                        $i++;
                    ?>
                        <li data-preview="<?php echo $img['url']; ?>" id="pr_<?php echo $i;?>"><a href="javascript:void(0);" ><img src="<?php echo $img['thumbnailUrl']; ?>" alt="image-preview" id="anc_<?php echo $i;?>" onMouseOver="div.show('div<?php echo $i ;?>')" onMouseOut="div.hide('div<?php echo $i ;?>')"/></a></li>
                        
                         <!--<li><img src="<?php echo $img['thumbnailUrl']; ?>" alt="" height="70" width="70"  onMouseOver="div.show('div<?php echo $i ;?>')" onMouseOut="div.hide('div<?php echo $i ;?>')"/>
                        <img src="<?php echo $img['url']; ?>" class="zoom-image" id="div<?php echo $i ;?>" alt="" style="visibility: hidden"/></li>-->
                    <?php } ?>
                   <!--</ul>-->
                  </ul>
                   <?php
                    $i= 0;
                    foreach($respon['HotelInformationResponse']['HotelImages']['HotelImage'] as $img)
                    {
                        $i++;
                   ?>                    
                        <img src="<?php echo $img['url']; ?>" class="zoom-image" id="div<?php echo $i ;?>" alt="" style="visibility: hidden"/>
                    <?php } }
                    ?>
                    <!-- End Elastislide Carousel -->
            </div>
                                    </div>
                <div  class="col-xs-12 col-md-6 col-lg-6 dtlsPrice">
                    <p class="night">Total <?php echo $_GET['totlday']; ?> Night</p>
                    <div class="hotel-details">
                            <div class="price-box">
                            <div class="price"><?php echo $h_price; ?></div>
                        </div>
                        <a href="<?php echo $store_url ; ?>" class="book-now" target="_blank">Book Now</a>
                    </div>
                </div>
                <div class="c1"></div>
                                    </div>
                <div class="row hotel-topics">
                    <div  class="col-xs-12 col-md-12 col-lg-12">
                     <?php echo html_entity_decode($respon['HotelInformationResponse']['HotelDetails']['propertyDescription']); ?>
                    </div>
                </div>
                <div class="row">
                    <div  class="col-xs-12 col-md-12 col-lg-12">
                            <div class="hotel-features">
                            <h2>Hotel Features</h2>
                            <div class="content">
                               <div class="hotel-topics">
                                 <h1>Hotel Policy</h1>
                                 <p><?php echo $respon['HotelInformationResponse']['HotelDetails']['hotelPolicy'] ; ?></p>
                              </div>
                                <div class="hotel-topics">
                                    <h1>Check-in</h1>
                                    <p>From <?php echo $respon['HotelInformationResponse']['HotelDetails']['checkInTime']; ?></p>
                                </div>
                                <div class="hotel-topics">
                                    <h1>Check-out</h1>
                                    <p>Prior to <?php echo $respon['HotelInformationResponse']['HotelDetails']['checkOutTime'];?></p>
                                </div>
                                <div class="hotel-topics">
                                    <h1>Property Information</h1>
                                    <p><?php echo $respon['HotelInformationResponse']['HotelDetails']['propertyInformation'];?></p>
                                </div>
                                <div class="hotel-topics">
                                    <h1>CheckIn Instructions</h1>
                                    <p><?php echo $respon['HotelInformationResponse']['HotelDetails']['checkInInstructions'];?></p>
                                </div>
                            </div>
                        </div>
                    <div class="note">
                          Note : It is the responsibility of the hotel chain and/or the individual property to ensure the accuracy of the photos displayed. 'www.compareandchoose.com.au' is not responsible for any inaccuracies in the photos.
                    </div>
                    </div>
                </div>
            </div>
            <div class="c1"></div>
        </div>
    </div>
    </div>
    
    <script type="text/javascript" src="js/jquery.elastislide.js"></script>
    <script type="text/javascript">
       
       // example how to integrate with a previewer
    
       var current = 0,
        $preview = $( '#preview' ),
        $carouselEl = $( '#carousel' ),
        $carouselItems = $carouselEl.children(),
        carousel = $carouselEl.elastislide( {
         current : current,
         minItems : 4,
         onClick : function( el, pos, evt ) {
    
          changeImage( el, pos );
          evt.preventDefault();
    
         },
         onReady : function() {
    
          changeImage( $carouselItems.eq( current ), current );
          
         }
        } );
    
       function changeImage( el, pos ) {
    
        $preview.attr( 'src', el.data( 'preview' ) );
        $carouselItems.removeClass( 'current-img' );
        el.addClass( 'current-img' );
        carousel.setCurrent( pos );
    
       }
    
      </script>
    <!-----footer Panel----->
    <?php echo $footer ;?>
    <!-----End of footer Panel----->
    </body>
    </html>
    

    yes looking into this I am not sure if it can be done

     

     

    I was thinking could we display or re-write to show www.myurl.com.au/hotel_name/test-hotel but still pass the whole url with the deep link I am not to sure

     

    here is our webpage code with the API credentials taken out

  2. Hi Professionals

     

    I am currently going through the process of grading my website in MOZ tools and getting over 2000 URLs to crawl errors

     

    The url I have is currently

    www.myurl.com.au/hotel_details.php?hotel_id=358705&currency_code=AUD&q=%27%3A%2F%2Fwww.travelnow.com%2Ftemplates%2F451536%2Fhotels%2F358705%2Foverview%3Flang%3Den%26amp%3Bcurrency%3DAUD%26amp%3BstandardCheckin%3D12%2F17%2F2014%26amp%3BstandardCheckout%3D12%2F18%2F2014%26amp%3BroomsCount%3D1%26amp%3Brooms[0].adultsCount%3D2%27&price=149&totlday=1
    
    
    How or where would I go about re-writing this I am not a professional with PHP and I have never done anything like this before
    

    Thanks in advance

  3. <?php
    require_once('config/config.php');
    include ("files/viator/api.php");
    $page = new PhpCode();
    $current_page = $page->curPageURL();
    $_SESSION['last_page'] = $current_page ;
    
    function seoUrl($string) {
        //Lower case everything
        $string = strtolower($string);
        //Make alphanumeric (removes all other characters)
        $string = preg_replace("/[^a-z0-9_\s-]/", "", $string);
        //Clean up multiple dashes or whitespaces
        $string = preg_replace("/[\s-]+/", " ", $string);
        //Convert whitespaces and underscore to dash
        $string = preg_replace("/[\s_]/", "-", $string);
        return $string;
    }
    if(isset($_GET['submit']) && !empty($_GET['submit'])) {
        $lookupId       = $_GET['lookupId'];
        $dest_code      = $_GET['dest_code'];
        $currency_code  = $_GET['currency_code'];
        $sortOrder      = $_GET['sortOrder'];
        $catId          = $_GET['catId'];
        $subcategoryId  = $_GET['subcategoryId'];
        $country_name   = $_GET['country_name'];
        $state_name     = $_GET['state_name'];
        $country_dest_id= $_GET['country_dest_id'];
        $check_in	    = $_GET['check_in'];
        $check_out	    = $_GET['check_out'];
        if($dest_code =='' && $country_dest_id != '') {
            $dest_code = $country_dest_id;
        }
    } else if(isset($_GET['search_submit']) && !empty($_GET['search_submit'])){   
        $dest_code      = $_GET['dest_code'];
        $currency_code  = $_GET['currency_code'];
        $sortOrder      = $_GET['sortOrder'];
        $catId          = $_GET['catId'];
        $subcategoryId  = $_GET['subcategoryId'];
        $country_name   = $_GET['country_name'];
        $state_name     = $_GET['state_name'];
        $country_dest_id= $_GET['country_dest_id'];
        $check_in	    = $_GET['check_in'];
        $check_out	    = $_GET['check_out'];
        $lookupId       = $_GET['lookupId'];
        if($dest_code =='' && $country_dest_id != '') {
            $dest_code = $country_dest_id;
        }    
    } else {
         $lookupId      = $_GET['lookupId'];
        $dest_code      = $_GET['dest_code'];
        $currency_code  = $_GET['currency_code'];
        $sortOrder      = $_GET['sortOrder'];
        $catId          = $_GET['catId'];
        $subcategoryId  = $_GET['subcategoryId'];
        $country_name   = $_GET['country_name'];
        $state_name     = $_GET['state_name'];
        $country_dest_id= $_GET['country_dest_id'];
        $check_in	    = $_GET['check_in'];
        $check_out	    = $_GET['check_out'];
        if($dest_code =='' && $country_dest_id != '') {
            $dest_code = $country_dest_id;
        }
    }
        $getdataarr         = getAdventureSearch($dest_code,$currency_code,$sortOrder,$check_in,$check_out);
        $adventure_data_arr = $getdataarr['data'];
        $image              = '' ;
    
    $part = new Body();
    $title = "Things to do in ";
    if($state_name !="")
    { $title .= $state_name.' ' ;}
    if ($country_name=="United States of America")
     { $title .= 'USA ' ;
       $breadcrumb = 'USA';}
    elseif ($country_name=="United Arab Emirates")
     { $title .= 'UAE ' ;
       $breadcrumb = 'UAE'; }
    elseif ($country_name!="")
    { $title .= $country_name; }
    $title .= " | Compare & Choose";
    
    $meta = '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <meta name="description" content="' .$state_name. ' Attractions & Things to do in ' .$country_name. '.  Find your adventure in ' .$country_name. ' Today." /><link rel="canonical" href="//www.compareandchoose.com.au/adventure_list"/>
    <!-- MICROFORMATS FOR GPLUS -->
    <link href="https://plus.google.com/+CompareandchooseAuTravel/posts" rel="publisher" />
    <meta itemprop="name" content="' .$title. '">
    <meta itemprop="description" content="' .$state_name. ' Attractions & Things to do in ' .$country_name. '.  Find your adventure in ' .$country_name. ' Today.">
    <meta property="og:locale" content="en_US" />
    <meta property="og:type" content="website" />
    <meta property="og:title" content="' .$title. '" />
    <meta property="og:description" content="' .$state_name. ' Attractions & Things to do in ' .$country_name. '.  Find your adventure in ' .$country_name. ' Today." />
    <meta property="og:url" content="http://www.compareandchoose.com.au/" />
    <meta property="og:site_name" content="Compare and Choose" />
    <meta property="article:publisher" content="https://www.facebook.com/compareandchoose" />
    <meta property="fb:app_id" content="1386609318277530" />
    <meta property="og:image" content="http://www.compareandchoose.com.au/images/Compare-and-Choose-logo.png" />
    <meta property="og:image:width" content="313" />
    <meta property="og:image:height" content="75" />';
    $head = $part->getHead($title,$meta);
    $header = $part->getHeader('Adventure');
    $footer = $part->getFooter();
    echo $head;
    echo $header;
    ?>
    <script>
        function sort() {
            $('.overlay_wrap').fadeIn();        $('.loader_hotel_page').fadeIn();
        }
    </script>
    <div class="overlay_wrap" style="display: none;"></div>
                         <div class="loader_hotel_page" style="display: none;"><img src="<?php echo SITE_URL; ?>images/search-loader.gif" alt="searching-records"/></div>
    <!-----Adventure Listing----->
    <div class="container">
        <div class="listing">            
                        <div class="row">
                        	<div class="col-xs-12 col-md-3 col-lg-3">
                            	<div class="refine-search travel">
                                    	<?php require_once('files/keyword_search.php'); ?>                                
                                    <div class="block">
                                    	<div class="block-content">
                                        	<div class="block-title">Top Selling Tours & Activities</div>
                                            <div class="block-inner">
                                            	<div class="top-rated-pic">
                                                	<!--<img src="images/small-pic1.png" alt="" />-->
                                                </div>
                                                <div class="top-topics-sec">
                                                    <?php
                                                    $getcatdataarr = getCategoryDestination($dest_code);
                                                    $category_arr  = $getcatdataarr['data'];
                                                    $i=1;
                                                    if($category_arr !="")
                                                    {
                                                    foreach ($category_arr as $categoryList) {
                                                    if($catId == $categoryList['id']) {
                                                        $image      = $categoryList['thumbnailURL'];
                                                        $groupName  = $categoryList['groupName'];  
                                                        ?>
                                                        <p onclick="sort()">
                                                            <strong><?php echo $i;?>.</strong><a href="adventure_list.php?currency_code=<?php echo $currency_code; ?>&dest_code=<?php echo $dest_code;?>&sortOrder=<?php echo $sortOrder;?>&catId=<?php echo $categoryList['id'];?>&country_name=<?php echo $country_name;?>&state_name=<?php echo $state_name;?>&country_dest_id=<?php echo $country_dest_id; ?>&lookupId=<?php echo $lookupId;?>&check_in=<?php echo $check_in;?>&check_out=<?php echo $check_out;?>"><?php echo stripslashes($categoryList['groupName']);?></a>
                                                            <?php 
                                                                $subcategories_arr = $categoryList['subcategories'];
                                                                
                                                                foreach($subcategories_arr as $subcatList) {
                                                                    echo '<br>';
                                                            ?>
                                                                    <a href="adventure_list.php?currency_code=<?php echo $currency_code; ?>&dest_code=<?php echo $dest_code;?>&sortOrder=<?php echo $sortOrder;?>&catId=<?php echo $categoryList['id'];?>&subcategoryId=<?php echo $subcatList['subcategoryId'];?>&country_name=<?php echo $country_name;?>&state_name=<?php echo $state_name;?>&country_dest_id=<?php echo $country_dest_id; ?>&lookupId=<?php echo $lookupId;?>&check_in=<?php echo $check_in;?>&check_out=<?php echo $check_out;?>"><?php echo stripslashes($subcatList['subcategoryName']); ?></a>
                                                            <?php
                                                                }
                                                              ?>  
                                                        </p>
                                                        <?php 
                                                        } else{
                                                    ?>
                                                <p onclick="sort()"><strong><?php echo $i;?>.</strong><a href="adventure_list.php?currency_code=<?php echo $currency_code; ?>&dest_code=<?php echo $dest_code;?>&sortOrder=<?php echo $sortOrder;?>&catId=<?php echo $categoryList['id'];?>&country_name=<?php echo $country_name;?>&state_name=<?php echo $state_name;?>&country_dest_id=<?php echo $country_dest_id; ?>&lookupId=<?php echo $lookupId;?>&check_in=<?php echo $check_in;?>&check_out=<?php echo $check_out;?>"><?php echo stripslashes($categoryList['groupName']);?></a></p>
                                                <?php }$i++;}
                                                }
                                                ?>
                                                </div></div></div></div></div></div>
                            <div class="col-xs-12 col-md-9 col-lg-9">
                            	<div class="travel-main">
                                	<div class="row">                                	
                                            <?php
                                              if($image !='')   {
                                                //$image = 'images/travel-pic.png';
    					    ?>
    					<div class="col-xs-12 col-md-4 col-lg-4">
    					    <!--<img src="<?php echo $image;?>" alt="" />-->
    					</div>
    					    <?php
                                              } 
                                            ?>
                                        <div class="col-xs-12">
                                        	<h1>Things to do in <?php echo stripslashes($country_name);?></h1>
                                            <?php
                                            if($state_name == '') {
                                                $search_name = $country_name;
                                            } else{
                                                 $search_name = $state_name;
                                            }
                                            ?>
                                            <p>Compare and choose things to do in <?php echo stripslashes($search_name);?></p>
                                            <a href="#"><?php echo strtoupper(stripslashes($search_name));?> >></a>
                                            <?php
                                            if($groupName != '') {
                                                echo '<p>'.$groupName.'</p>';
                                            }
                                            ?>
                                            <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="GET">
                                    <div class="filtering">
                                      <select onchange="this.form.submit();" name="sortOrder">
                                        <option value="TOP_SELLERS" <?php if($sortOrder == 'TOP_SELLERS'){echo 'selected';}?>>Most Popular</option>
                                        <option value="REVIEW_AVG_RATING_D" <?php if($sortOrder == 'REVIEW_AVG_RATING_D'){echo 'selected';}?>>Top Rated</option>
                                        <option value="PRICE_FROM_A" <?php if($sortOrder == 'PRICE_FROM_A'){echo 'selected';}?>>Price(Low - High)</option>
                                        <option value="PRICE_FROM_D" <?php if($sortOrder == 'PRICE_FROM_D'){echo 'selected';}?>>Price(High - Low)</option>
                                      </select>
                                      <input type="hidden" name="currency_code" value="<?php echo $currency_code;?>" id="currency_code">
                                      <input type="hidden" name="lookupId" value="<?php echo $lookupId;?>" id="lookupId">
                                      <input type="hidden" name="dest_code" value="<?php echo $dest_code;?>" id="dest_code">
                                      <input type="hidden" name="catId" value="<?php echo $catId;?>" id="catId">
                                      <input type="hidden" name="subcategoryId" value="<?php echo $subcategoryId;?>" id="subcategoryId">
                                      <input type="hidden" name="country_name" value="<?php echo $country_name; ?>" id="country_name" >
                                      <input type="hidden" name="state_name" value="<?php echo $state_name;?>" id="state_name">
                                      <input type="hidden" name="country_dest_id" value="<?php echo $country_dest_id;?>" id="country_dest_id">				    
                                    </div>
                                    </form>
                                        </div><div class="c1"></div></div></div>
                                <?php
                                if($adventure_data_arr != ""){
                                   foreach($adventure_data_arr as $adventureList) {
                                   $url = seoUrl($adventureList['title']);
                                   if($catId == '') {
                               ?>
                                <div class="travel-list-sec">
                                	<div class="row">
                                        <div class="col-xs-12 col-md-3 col-lg-3 spacal-img">
                                            <?php
                                            if($adventureList['specialOfferAvailable'] == 1)
                                            {?>
                                            <div class="spacal-tag">
                                                <img src="images/specila-tag.png" alt="" />
                                            </div>
                                            <?php } ?>                                        
                                        	<img src="<?php echo $adventureList['thumbnailHiResURL'];?>" alt="" width="166" height="160" />
                                        </div>
                                        <div class="col-xs-12 col-md-9 col-lg-9">
                                        	<div class="travel-det"> 
                                        	<h2 style="text-transform: uppercase; font: 400 15px 'Open Sans', sans-serif; text-decoration: none;"><a style="color: rgb(103, 191, 54);" href="adventure_details.php?name=<?php echo $url;?>&code=<?php echo $adventureList['code'];?>&currencyCode=<?php echo $adventureList['currencyCode'];?>&lookupId=<?php echo $lookupId;?>&dest_code=<?php echo $dest_code; ?>"><?php echo stripslashes($adventureList['title']);?></a></h2>
                                            <p><?php echo stripslashes($adventureList['shortDescription']);?></p>
                                                <div class="rating-box">
                                                  <div class="ratings">
                                                    <?php
                                                        $rate = $adventureList['rating'];
                                                        $f= floor($rate);
                                                        $c = ceil($rate);
                                                        $cnt = 0;
                                                        if($rate!="" && $rate!=0)
                                                        { for($in = 1; $in<=$rate ;$in++)
                                                          { $cnt++; ?>
                                                            <img src="images/rating_full.png">
                                                    <?php } if($f != $c)
                                                             { $cnt++;
                                                            ?> <img src="images/rating_half.png">
                                                   <?php } }
                                                        if($cnt<5) {
                                                            while($cnt<5)
                                                            { $cnt++;
                                                                ?> <img src="images/rating_blank.png">
                                                        <?php  } }
                                                    ?>
                                                    <!--<span class="stars"><?php echo $adventureList['rating']; ?></span>-->
                                                  </div>
                                                <div class="rating-txt">
                                                	based on <?php echo $adventureList['reviewCount']; ?> reviews
                                                </div>
                                                <div class="c1"></div>
                                            </div>                                            
                                            <div class="price-box"><a href="adventure_details.php?name=<?php echo $url;?>&code=<?php echo $adventureList['code'];?>&currencyCode=<?php echo $adventureList['currencyCode'];?>&lookupId=<?php echo $lookupId;?>&dest_code=<?php echo $dest_code; ?>">
                                            <span style="float: right; margin-right: 1%; padding: 6px 20px; color: white; background-color: rgb(108, 191, 61); text-align: center; font-size:16px; font-weight:400;
    ">See Details →</span></a>                                  
                                               <span class="new_price">Duration :<?php echo stripslashes($adventureList['duration']);?></span><br />
                                            	<span class="new_price">From <?php echo stripslashes($adventureList['currencyCode']);?> <?php echo stripslashes($adventureList['priceFormatted']);?></span>
                                                    <?php
                if($adventureList['specialOfferAvailable'] == 1) {
                 ?>
                 <div class="original">
                   <p>Original Price : <?php echo stripslashes($adventureList['rrpformatted']);?></p>
                 </div>
                 <div class="save-price">
                    <p>Saving Amount : <?php echo stripslashes($adventureList['savingAmountFormated']);?></p>
                 </div>
              <?php
                }
                ?>
                                            </div></div></div><div class="c1"></div></div></div>
                                 <?php
                                    } else {
                                        if($subcategoryId == '') {
                                         $catgory_arr = $adventureList['catIds'];
                                        if(in_array($catId, $catgory_arr)) {        
                                 ?>
                                  <div class="travel-list-sec">
                                	<div class="row">
                                    	<div class="col-xs-12 col-md-3 col-lg-3">
                                        	<img src="<?php echo $adventureList['thumbnailHiResURL'];?>" alt="" width="166" height="160" />
                                        </div>
                                        <div class="col-xs-12 col-md-9 col-lg-9">
                                        	<div class="travel-det">
                                        	<h1><a href="adventure_details.php?name=<?php echo $url;?>&code=<?php echo $adventureList['code'];?>&currencyCode=<?php echo $adventureList['currencyCode'];?>"><?php echo stripslashes($adventureList['title']);?></a></h1>
                                            <p><?php echo stripslashes($adventureList['shortDescription']);?></p>
                                                <div class="rating-box">
                                                    <span class="stars"><?php echo $adventureList['rating']; ?></span>
                                                <div class="rating-txt">
                                                	based on <?php echo $adventureList['reviewCount']; ?> reviews
                                                </div>
                                                <div class="c1"></div>
                                            </div>            
                                            <div class="price-box">
                                                <div class="price">Duration :<?php echo stripslashes($adventureList['duration']);?></div>
                                            	<div class="price">From <?php echo stripslashes($adventureList['currencyCode']);?> <?php echo stripslashes($adventureList['priceFormatted']);?></div>
                                                    <?php
                if($adventureList['specialOfferAvailable'] == 1) {
                 ?>
                 <h3>Special Offer </h3>
                 <p>Original Price : <?php echo stripslashes($adventureList['rrpformatted']);?></p>
                 <p>Saving Amount : <?php echo stripslashes($adventureList['savingAmountFormated']);?></p>
              <?php
                }
                ?>
                                            </div></div></div><div class="c1"></div></div></div>
                                 <?php
                                        }
                                      } else{
                                       $sub_catgory_arr = $adventureList['subCatIds'];
                                        if(in_array($subcategoryId, $sub_catgory_arr)) {                 
                                ?>
                                <div class="travel-list-sec">
                                	<div class="row">
                                    	<div class="col-xs-12 col-md-3 col-lg-3">
                                        	<img src="<?php echo $adventureList['thumbnailHiResURL'];?>" alt="" width="166" height="160" />
                                        </div>
                                        <div class="col-xs-12 col-md-9 col-lg-9">
                                        	<div class="travel-det">
                                        	<h1><a href="adventure_details.php?name=<?php echo $url;?>&code=<?php echo $adventureList['code'];?>&currencyCode=<?php echo $adventureList['currencyCode'];?>"><?php echo stripslashes($adventureList['title']);?></a></h1>
                                            <p><?php echo stripslashes($adventureList['shortDescription']);?></p>                                      
                                                <div class="rating-box">
                                                    <span class="stars"><?php echo $adventureList['rating']; ?></span>
                                                <div class="rating-txt">
                                                	based on <?php echo $adventureList['reviewCount']; ?> reviews
                                                </div>
                                                <div class="c1"></div>
                                            </div>                                            
                                            <div class="price-box">
                                                <div class="price">Duration :<?php echo stripslashes($adventureList['duration']);?></div>
                                            	<div class="price">From <?php echo stripslashes($adventureList['currencyCode']);?> <?php echo stripslashes($adventureList['priceFormatted']);?></div>
                                                    <?php
                if($adventureList['specialOfferAvailable'] == 1) {
                 ?>
                 <h3>Special Offer </h3>
                 <p>Original Price : <?php echo stripslashes($adventureList['rrpformatted']);?></p>
                 <p>Saving Amount : <?php echo stripslashes($adventureList['savingAmountFormated']);?></p>
              <?php
                }
                ?>
                                            </div></div></div><div class="c1"></div></div></div>
                                <?php
    							 } } } } }  
    							 ?>                           
                            </div><div class="breadcrumb-new">
           <ul>                 
           <li><div itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
           <a href="<?php echo SITE_URL;?>" itemprop="url"><span itemprop="title">Home</span></a><span>></span>
        </div></li>
           <li><strong>Adventures & Activities in <?php echo $state_name. ',' .$country_name; ?></strong></li>
           </ul>      
       </div><div class="c1"></div></div></div></div>
    <?php echo $footer ;?>
    </body>
    </html>
    

    Hi All

     

    I am trying to change my website from http to https and I have ran into a problem with one of the scripts producing a none secure http problem

     

    Basically when I check this it shows a none secure error

     

    ERROR

    insecure url = http://cache.graphicslib.viator.com/etcetcetc.jpg which needs to be https://cache.graphicslib.viator.com/etcetcetc.jpg

     

    I thinks it is something to do with the array $adventureList array on line 285(not exactly sure, as I didn't write the code and I am not an expert)

     

     

    So my question is how do I change this to https url

     

    please find attached my page code

     

     

    thanks in advance all

     

    Alan

     

  4. http://www.compareandchoose.com.au/video_games?shopingfor=US&shopingfor=US
    http://www.compareandchoose.com.au/video_games?shopingfor=AU&shopingfor=US
    http://www.compareandchoose.com.au/video_games?shopingfor=UK&shopingfor=US
    http://www.compareandchoose.com.au/video_games?shopingfor=US&shopingfor=UK
    http://www.compareandchoose.com.au/video_games?shopingfor=AU&shopingfor=UK
    http://www.compareandchoose.com.au/video_games?shopingfor=UK&shopingfor=UK
    http://www.compareandchoose.com.au/video_games?shopingfor=US&shopingfor=AU
    http://www.compareandchoose.com.au/video_games?shopingfor=AU&shopingfor=AU
    http://www.compareandchoose.com.au/video_games?shopingfor=UK&shopingfor=AU
    
    when it should only show
    
    http://www.compareandchoose.com.au/video_games?shopingfor=US
    http://www.compareandchoose.com.au/video_games?shopingfor=AU
    http://www.compareandchoose.com.au/video_games?shopingfor=UK
    
    why its appending all combinations I am not sure
    
    Please find my 3 page code files it uses
    

    Hi Professionals

     

    I have been doing a site check with MOZ tools and it is showing duplicate page content for all my shopping pages

    Basically I have a site where you can compare products for either the UK,US or AU

     

    But it is showing the above results in MOZ

     

    I have tried everything to figure this out, but because it was not written by me I cannot pin point it

     

    Please find attached the 3 pages it utilises

     

     

     

     

    check_form.php

    shopping_video_games.php

    video_games.php

  5. RewriteCond %{HTTPS} =on [OR]
    RewriteCond %{HTTP_HOST} !=www.example.com.au
    RewriteRule ^ https://www.example.com.au%{REQUEST_URI} [L,R]
    

    hi there Requinix thanks for that and yeah its for a crazy reason because I cannot switch fully to https yet because of a partner link that do not use https yet

     

    could I just change it all to https once they have made the switch hopefully in the next couple of days to force it all to https or would I be better of waiting a few more days for the sake of my seo rankings

     

     

    would this work to force it back to https

  6. 
    RewriteCond %{HTTP_HOST} !^www.example.com.au$ [NC] 
    RewriteCond %{HTTP_HOST} !^https://www.example.com.au$ [NC]
    RewriteRule ^(.*)$ http://www.example.com.au/$1 [R,L]
    

    Hi All

     

    I have my website 90% working on https, fully working on http and I have managed to redirect from none www to www

     

     

    What I am looking to do it if the user happens to enter https then make them go to my www version

     

     

    I have manage to get them to go to my www version if they do not put in www but I am lost in how to redirect them from https to http

     

    here is what I have so far and I just cannot figure it out

     

     

    thanks

    Alan

  7. Hi thanks for that I now have
    
    SELECT R.RegionName, A.City,A.StateProvince,A.Country,A.CountryName
    FROM `activepropertylist` A
    JOIN `RegionEANHotelIDMapping` RM ON A.EANHotelID = RM.EANHotelID
    JOIN `parentregionlist` R ON RM.RegionID = R.RegionID
    WHERE MATCH(City, RegionName) AGAINST ('hervey bay' IN BOOLEAN MODE)
    
    which works
    

    I have a fulltext index on both the City & RegionName but the trouble is it is taking approx. 7 seconds to return in the backend DB, If I make this live it is more than likely going to be longer which would make the user sit and wait for wuite sometime when searching on an area from the drop down box

     

    Is there a way to speed it up any further?

     

    here is the schema image attached for further information

     

    Basically what I am trying to do is be able to let the user pick from my search box an area, which I am using for auto predict just like expedia do with there auto search for hotels

    post-166889-0-17879200-1407722653_thumb.png

  8. MY QUERY
    
    SELECT City, Country
    FROM `activepropertylist`
    WHERE MATCH(City) AGAINST ('+"hervey bay"' IN BOOLEAN MODE)
    GROUP BY City,Countryname,Country
    
    union all
    SELECT RegionName,RegionID
    FROM `parentregionlist`
    WHERE MATCH(RegionName) AGAINST ('+"hervey bay"' IN BOOLEAN MODE)
    
    RESULTS
    
    
    City,Country  
     
    Hervey Bay 6053026 
    
    Hervey Bay Golf and Country Club 6217212 
    
    Hervey Bay Golf and Country Club 6217213 
    
    Hervey Bay Historical Village Museum 6217250 
    
    Hervey Bay Historical Village Museum 6217253 
    
    Hervey Bay Botanic Garden 6217257 
    
    Hervey Bay Botanic Garden 6217259 
    
    When really it should be
    
    RegionName,RegionID  
     
    Hervey Bay 6053026 
    
    Hervey Bay Golf and Country Club 6217212
    
    

    I have an update. Apparently I only need to look into two tables for the place, so what I am trying to do is find out of the keyword "hervey bay" exists in the activeproperty list table.  If it does not does it exist in the parentregionlist table

     

    but I am getting some strange results there seems to be something I am missing as it only shows the two columns from the parentregionlist table when I want to show all 4

     

    here is my query and results

  9. SELECT R.RegionName, A.City 
    FROM 
    `activepropertylist` A,
    `ParentRegionList` R,
    `RegionEANHotelIDMapping` RM
    WHERE MATCH(City, RegionName) AGAINST ('hervey bay' IN BOOLEAN MODE)
    and A.EANHotelID = RM.EANHotelID
    and RM.RegionID = R.RegionID
    and R.RegionType = 'Neighborhood'
    
    
    schema
    
    http://developer.ean.com/database-catalogs/relational/geography-data/
    
    book a suit search box example
    
    http://www.bookasuite.com/
    
    
    

    I am trying to join 3 tables together to get the correct information from expedia tables for my auto drop down box

     

    the schema is here, located in the link and I am looking auto search like book a suite do(link also provided)

     

    problem is I can manage to get the word hervey bay out of the property region list table but the incorrect city comes back from the activeproperylist table(it seems to be showing something from the other table for the city)

     

     

    here is my query

     

     

     

     

  10. $q=$_POST['search'];
    
    $string = '"' .$q. '"';
    
    $sql_res=mysql_query("SELECT COUNT( City ) AS Hotel, City, CountryName, Country
    FROM `activepropertylist`
    WHERE MATCH(City) AGAINST ('$string' IN BOOLEAN MODE)
    GROUP BY City,Countryname,Country
    ORDER BY City
    LIMIT 10");
    

    hi Jazzman

     

    thanks for this help and yes it is working now I just had to wait for the webserver to refresh but I still have a problem

     

    like you said it is because it is enclosed around double quotes now the word has to be exact so

     

    it will find south shields

    it will find newcastle

    Newcastle upon

     

    Newcastle upon tyne which is fantastic

     

    but I am looking for it to actually auto predict

     

    EG

     

    if you type in "Newcastle up" or Newcastle upon ty" it will not auto predict "Newcastle upon tyne" until you have typed the full word.

     

    is there a way around this

     

    you can see for your self on my site which is www compareandchoose.com.au/hotel

     

    also here is the updated code

     

    finally thanks again in advance (what I have so far now is good, but would be better if it auto predicted the keyword in question)

  11. $q=$_POST['search'];
    
    $string = '"' .$q. '"';
    
    echo $sql = "SELECT COUNT( City ) AS Hotel, City, CountryName, Country
    FROM `activepropertylist`
    WHERE MATCH(City,Countryname) AGAINST ('+$string' IN BOOLEAN MODE)
    GROUP BY City,Countryname,Country
    ORDER BY City";
    

    yes that's what I am doing now and it does not seem to work it just hangs and hangs but does not show anything

     

    even though it works instantly in the database

     

    here is what I have

     

     

  12.    $q=$_POST['search'];
        
    	$string = '"' .$q. '"';
    
    
    	    $sql_res=mysql_query("SELECT COUNT( City ) AS Hotel, City, CountryName, Country
    FROM `activepropertylist`
    WHERE MATCH(city,Countryname) AGAINST ('+$string' IN BOOLEAN MODE)
    GROUP BY City,Countryname,Country
    ORDER BY City");
    
    SELECT COUNT( City ) AS Hotel, City, CountryName, Country
    FROM `activepropertylist`
    WHERE MATCH(City) AGAINST ('+"South shields"' IN BOOLEAN MODE)
    GROUP BY City,Countryname,Country
    ORDER BY City
    LIMIT 15
    

    hi again thanks for that

     

     

    I have managed to figure the query out in the backend of the database which works for south shields now and is lightening fast

     

    EG

     

    but because of the double quotes  around the word south shields I cannot get my head round it in php as my query already has double quotes

     

    in php I am trying this but it does not work

     

     

     

     

  13. SELECT COUNT( City ) AS Hotel, City, CountryName, Country
    FROM `activepropertylist`
    WHERE MATCH(city,Countryname) AGAINST ('South shields*' IN BOOLEAN MODE)
    GROUP BY City,Countryname,Country
    ORDER BY City
    LIMIT 15
    

    hi all I have a query against the database table which uses the full text index's and I am limiting this to 15 rows for the ajax

     

    problem is it is returning Africa and other things before south shields

     

    is there something I am missing as I know South shields is in there when scrolling through all the results

     

     

    here is my query

     

     

  14. foreach ($array['Itineraries'] as $Itineraries) {
            foreach($Itineraries['PricingOptions'] as $Option) {
                 echo "<b> Agents: </b> ";
    
                 // loop over agents for current priceOption
                 foreach($Option['Agents'] as $agentId) {
                      echo $Agents[ $agentId ]['Name']. ', '; // echo the agent name that matches agentId.
                 }
                   
                 echo " <br> price </b>",$Option['Price'] ,"<br />";
    			 
           }
    	}
    		
    		//Legs
    		foreach ($array['Legs'] as $Leg) {
    		
    			echo "<b>   Depart </b> " .$Leg['Departure'], " <b>   Arrive </b>",$Leg['Arrival'] ," <b>   Direction </b>",$Leg['Directionality'] ,"  <b> Flight Duration </b>", $Leg['Duration'] , "  Minutes, <b>   Number of Stops </b>", $Leg['Stops'] , "<br />";
    		}
    

    I have managed to get a little further if anyone can help me figure out this looping problem

     

    it loops through the agents so agent 1 would match leg 1, agent 2 would match leg 2 and so on but I have this code which loops through all the agents and then all the legs after that but I want to do agent 1, leg1 as stated

     

     

    Please any help would be a massive hurdle for me

     

    thanks in advance

     

     

     

     

     

  15. <?php
    
    function extractItem(&$array, $itemKey)
    {
    	$data = array();
            
    	foreach($array[$itemKey] as $item)
    	{
                  $Id = $item['Id'];  // get the id
                  unset($item['Id']); // remove the id from item array
                  $data[$Id] = $item; // set id as the key
    	}
    
    	unset($array[$itemKey]); // remove item from array.
    
    	return $data; // return the new item array
    } 
    
    
    // get the api parametures from setup url
        $country_code = $_GET['country'];
        $originplace  = $_GET['strtplace'];
        $destination  = $_GET['endplace'];
        $start_date   = $_GET['startdate'];
        if(isset($_GET['enddate']) && $_GET['enddate']!=""){
        $end_date     = $_GET['enddate'];}
        $audult       = $_GET['audult'];
        if(isset($_GET['child']) && $_GET['child']!=""){
        $child        = $_GET['child'];}
        if(isset($_GET['infent']) && $_GET['infent']!=""){
        $infent       = $_GET['infent'];}
        $class        = $_GET['class'];
        
        if (!empty($_SERVER['HTTP_CLIENT_IP'])){
        $ip=$_SERVER['HTTP_CLIENT_IP'];}
        elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
        $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];}
        else{$ip=$_SERVER['REMOTE_ADDR'];}
        $xml = simplexml_load_file("http://www.geoplugin.net/xml.gp?ip=".$ip);
        $ip_curency = $xml->geoplugin_currencyCode ;
    
        $query  = "&country=".$country_code;
        $query .= "&currency=".$ip_curency;
        $query .= "&locale=en-GB";
        $query .= "&originplace=".$originplace;
        $query .= "&destinationplace=".$destination;
        $query .= "&outbounddate=".$start_date;
        if(isset($end_date) && $end_date!=""){
        $query .= "&inbounddate=".$end_date;}
        $query .= "&adults=".$audult;
        if(isset($child) && $child!=""){
        $query .= "&children=".$child;}
        if(isset($infent) && $infent!=""){
        $query .= "&infants=".$infent;}
        $query .="&locationschema=iata";
        $query .="&cabinclass=".$class;
        $query .="&pagesize=10";
    
    $apiParamsUrl = "http://partners.api.skyscanner.net/apiservices/pricing/v1.0/".$country_code."?apikey=SECRET".$query."";
    $apiParamsStr = parse_url($apiParamsUrl, PHP_URL_QUERY); // get the query string parametures
    parse_str($apiParamsStr, $apiParamsArray); // parse into an array
    
    // the api url. First we need to request for a session
    $apiSessionUrl = 'http://partners.api.skyscanner.net/apiservices/pricing/v1.0';
    
    //open connection
    $ch = curl_init();
    
    //set the url, number of POST vars, POST data
    curl_setopt($ch,CURLOPT_URL, $apiSessionUrl);
    curl_setopt($ch,CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded', 'Accept: application/json')); // make api return json data
    curl_setopt($ch,CURLOPT_POST, count($apiParamsArray)); // set how many fiels
    curl_setopt($ch,CURLOPT_POSTFIELDS, $apiParamsStr);    // set the fields
    
    // caputre the headers
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_VERBOSE, 1);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    
    //execute post
    $response = curl_exec($ch);
    
    // get the headers
    $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
    $header = substr($response, 0, $header_size);
    $body = substr($response, $header_size);
    
    //close connection
    curl_close($ch);
    
    // get the api session url
    preg_match('~Location: ([^\s]+)~', $header, $matches);
    $apiSessionUrl = $matches[1];
    
    // add on the api key for the session
    $apiSessionUrl .= '?apiKey=' . $apiParamsArray['apikey'];
    
    // get the json data
    $data = file_get_contents($apiSessionUrl);
    
    // decode the json
    $array = json_decode($data, true);
    
    // dump json array
    printf('<pre>Poll Data  %s</pre>', print_r($array, true));
    
    //Itineraries
    //		$Agents   = extractItem($array, 'Agents');   // get array of agents
    //...
    
    	foreach ($array['Itineraries'] as $Itineraries) {
            foreach($Itineraries['PricingOptions'] as $Option) {
                 echo "<b> Agents: </b> ";
    
                 // loop over agents for current priceOption
                 foreach($Option['Agents'] as $agentId) {
                      echo $Agents[ $agentId ]['Name']. ', '; // echo the agent name that matches agentId.
                 }
                   
                 echo " <br> price </b>",$Option['Price'] ,"<br />";
           }
    	}
    		
    		//Legs
    		foreach ($array['Legs'] as $Leg) {
    		
    			echo "<b> Depart </b> " .$Leg['Departure'], " <b> Arrive </b>",$Leg['Arrival'] ,"  <b> Flight Duration </b>", $Leg['Duration'] , " Minutes, <b> Number of Stops </b>", $Leg['Stops'] , "<br />";
    		}
    		
    		//Carriers
    		foreach ($array['Carriers'] as $Carrier) {
    		
    				echo "<b> Name </b> " .$Carrier['Name'], " <b> Image </b>", $Carrier['ImageUrl'] ,"<br />";
    				
    		}
    		
    		//Places
    		foreach ($array['Places'] as $Place) {
    		
    			echo "<b> Place Code </b> " .$Place['Code'], " <b> Place Name </b>",$Place['Name'] ,"<br />";
    		}
    ?>
    

    Hi all

     

    I bit of an update

     

     

    I have managed to extract a bit more information at the bottom as you can see at the bottom of the array.

     

     

    2 things I still seem t be struggling with are

     

    1:  the function call I have commented out because I cannot figure why its not working

     

    2:  I obviously want to present this nicely EG

     

     

    6:35 am - 10:40 am    21hrs 5 mins, 1 stop Price $2560.24

     

    BNE        LAX                                    SYD

    Brisbane Los Angeles                       Sydney

     

     

     

     

    something like the way expedia do it which I have attached an example

     

    please see my updated code, im a bit lost with it now

     

     

    thanks all

     

     

    you can also see working text here dev DOT compareandchoose DOT com DOT au/sky/Alan_test

     

    I hope I have provided enough information

    post-166889-0-09513400-1405160582_thumb.png

  16. <?php
    
    function extractItem(&$array, $itemKey)
    {
    	$data = array();
            
    	foreach($array[$itemKey] as $item)
    	{
                  $Id = $item['Id'];  // get the id
                  unset($item['Id']); // remove the id from item array
                  $data[$Id] = $item; // set id as the key
    	}
    
    	unset($array[$itemKey]); // remove item from array.
    
    	return $data; // return the new item array
    } 
    
    
    // get the api parametures from setup url
        $country_code = $_GET['country'];
        $originplace  = $_GET['strtplace'];
        $destination  = $_GET['endplace'];
        $start_date   = $_GET['startdate'];
        if(isset($_GET['enddate']) && $_GET['enddate']!=""){
        $end_date     = $_GET['enddate'];}
        $audult       = $_GET['audult'];
        if(isset($_GET['child']) && $_GET['child']!=""){
        $child        = $_GET['child'];}
        if(isset($_GET['infent']) && $_GET['infent']!=""){
        $infent       = $_GET['infent'];}
        $class        = $_GET['class'];
        
        if (!empty($_SERVER['HTTP_CLIENT_IP'])){
        $ip=$_SERVER['HTTP_CLIENT_IP'];}
        elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
        $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];}
        else{$ip=$_SERVER['REMOTE_ADDR'];}
        $xml = simplexml_load_file("http://www.geoplugin.net/xml.gp?ip=".$ip);
        $ip_curency = $xml->geoplugin_currencyCode ;
    
        $query  = "&country=".$country_code;
        $query .= "&currency=".$ip_curency;
        $query .= "&locale=en-GB";
        $query .= "&originplace=".$originplace;
        $query .= "&destinationplace=".$destination;
        $query .= "&outbounddate=".$start_date;
        if(isset($end_date) && $end_date!=""){
        $query .= "&inbounddate=".$end_date;}
        $query .= "&adults=".$audult;
        if(isset($child) && $child!=""){
        $query .= "&children=".$child;}
        if(isset($infent) && $infent!=""){
        $query .= "&infants=".$infent;}
        $query .="&locationschema=iata";
        $query .="&cabinclass=".$class;
        $query .="&pagesize=10";
    
    $apiParamsUrl = "http://partners.api.skyscanner.net/apiservices/pricing/v1.0/".$country_code."?apikey=SECRET".$query."";
    $apiParamsStr = parse_url($apiParamsUrl, PHP_URL_QUERY); // get the query string parametures
    parse_str($apiParamsStr, $apiParamsArray); // parse into an array
    
    // the api url. First we need to request for a session
    $apiSessionUrl = 'http://partners.api.skyscanner.net/apiservices/pricing/v1.0';
    
    //open connection
    $ch = curl_init();
    
    //set the url, number of POST vars, POST data
    curl_setopt($ch,CURLOPT_URL, $apiSessionUrl);
    curl_setopt($ch,CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded', 'Accept: application/json')); // make api return json data
    curl_setopt($ch,CURLOPT_POST, count($apiParamsArray)); // set how many fiels
    curl_setopt($ch,CURLOPT_POSTFIELDS, $apiParamsStr);    // set the fields
    
    // caputre the headers
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_VERBOSE, 1);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    
    //execute post
    $response = curl_exec($ch);
    
    // get the headers
    $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
    $header = substr($response, 0, $header_size);
    $body = substr($response, $header_size);
    
    //close connection
    curl_close($ch);
    
    // get the api session url
    preg_match('~Location: ([^\s]+)~', $header, $matches);
    $apiSessionUrl = $matches[1];
    
    // add on the api key for the session
    $apiSessionUrl .= '?apiKey=' . $apiParamsArray['apikey'];
    
    // get the json data
    $data = file_get_contents($apiSessionUrl);
    
    // decode the json
    $array = json_decode($data, true);
    
    // dump json array
    printf('<pre>Poll Data  %s</pre>', print_r($array, true));
    
    //Itineraries
    		$Agents   = extractItem($array, 'Agents');   // get array of agents
    //...
    
    	foreach ($array['Itineraries'] as $Itineraries) {
            foreach($Itineraries['PricingOptions'] as $Option) {
                 echo "<b> Agents: </b> ";
    
                 // loop over agents for current priceOption
                 foreach($Option['Agents'] as $agentId) {
                      echo $Agents[ $agentId ]['Name']. ', '; // echo the agent name that matches agentId.
                 }
                   
                 echo " <br> price </b>",$Option['Price'] ,"<br />";
           }
    	}
    		
    		//Legs
    		foreach ($array['Legs'] as $Leg) {
    		
    			echo "<b> Departure </b> " .$Leg['Departure'], " <br> <b>Arrival </b>",$Leg['Arrival'] ,"<br />";
    		}
    		
    		//Carriers
    		foreach ($array['Carriers'] as $Carrier) {
    		
    				echo "<b> Name </b> " .$Carrier['Name'], " <br> Image </b>",$Carrier['ImageUrl'] ,"<br />";
    		}
    		
    		//Places
    		foreach ($array['Places'] as $Place) {
    		
    			echo "<b> Code </b> " .$Place['Code'], " <br> Name </b>",$Place['Name'] ,"<br />";
    		}
    ?>
    

    Hi professionals

     

    I am trying to extract the correct information from a flights API

     

    It was working until I added in the function.

     

    Now I just see the word Poll Data on my screen

     

    is there something I am missing here (code attached)

     

    Thanks

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.