예제 #1
0
    public function actionRen()
    {
        $a = '<SearchRS>
 <MatchList>
 <Match>
 <Vehicle id="274462398"
 propositionType="BR"
 automatic="Manual"
 aircon="Yes"
 airbag="false"
 petrol="N/A"
 group="ECMR"
 doors="2/4"
 seats="4"
 fuelPolicy="1"
 insurancePkg="I"
 freeCancellation="true"

 >
 <Name>Hyundai i20</Name>
 <Description>這輛兩個車門配備車載空調的經濟型轎車,是兩個人和小型家庭出遊的理想選擇。</Description>
 <ImageURL>http://xml.rentalcars.com:80/images/car_images/C/hyundai_i20.jpg</ImageURL>
 <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/C/hyundai_i20.jpg</LargeImageURL>
 </Vehicle>
 <Price currency="USD"
   baseCurrency="CNY"
   basePrice="1446.28"


   deposit="0.00"

   baseDeposit="0.0"


   discount="28.21"


   quoteAllowed="yes"

   >235.45</Price>
  <Route>
 <PickUp>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </PickUp>
 <DropOff>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </DropOff>
 </Route>
 <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier>
  </Match>
 <Match>
 <Vehicle id="274462388"
 propositionType="BR"
 automatic="Automatic"
 aircon="Yes"
 airbag="false"
 petrol="N/A"
 group="CDAR"
 doors="4"
 seats="5"
 fuelPolicy="1"
 insurancePkg="I"
 freeCancellation="true"

 >
 <Name>Hyundai Accent</Name>
 <Description>理想的家庭用車,四車門自動檔車身小型配备车载空调价格经济实惠。</Description>
 <ImageURL>http://xml.rentalcars.com:80/images/car_images/D/hyundai_accent.jpg</ImageURL>
 <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/D/hyundai_accent.jpg</LargeImageURL>
 </Vehicle>
 <Price currency="USD"
   baseCurrency="CNY"
   basePrice="1606.45"


   deposit="0.00"

   baseDeposit="0.0"


   discount="31.34"


   quoteAllowed="yes"

   >261.53</Price>
  <Route>
 <PickUp>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </PickUp>
 <DropOff>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </DropOff>
 </Route>
 <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier>
  </Match>
 <Match>
 <Vehicle id="237178731"
 propositionType="BR"
 automatic="Automatic"
 aircon="Yes"
 airbag="false"
 petrol="N/A"
 group="ECAR"
 doors="2/4"
 seats="4"
 fuelPolicy="1"
 insurancePkg="I"
 freeCancellation="true"

 >
 <Name>Suzuki Swift</Name>
 <Description>這輛兩個車門配備車載空調的經濟型轎車,是兩個人和小型家庭出遊的理想選擇。</Description>
 <SpecialOfferText>可免费添加一名额外驾驶人</SpecialOfferText>
 <ImageURL>http://xml.rentalcars.com:80/images/car_images/C/suzuki_swift.jpg</ImageURL>
 <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/C/suzuki_swift.jpg</LargeImageURL>
 </Vehicle>
 <Price currency="USD"
   baseCurrency="CNY"
   basePrice="1676.43"


   deposit="0.00"

   baseDeposit="0.0"


   discount="32.70"


   quoteAllowed="yes"

   >272.92</Price>
  <Route>
 <PickUp>
 <Location id="804148" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </PickUp>
 <DropOff>
 <Location id="804148" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </DropOff>
 </Route>
 <Supplier long="153.03126" lat="-27.46062" small_logo="http://xml.rentalcars.com:80/images/suppliers/thrifty_logo_lrg.gif"><![CDATA[Thrifty AW]]></Supplier>
  </Match>
 <Match>
 <Vehicle id="274462453"
 propositionType="BR"
 automatic="Manual"
 aircon="Yes"
 airbag="true"
 petrol="N/A"
 group="CDMR"
 doors="4"
 seats="5"
 fuelPolicy="1"
 insurancePkg="I"
 freeCancellation="true"

 >
 <Name>Hyundai i20</Name>
 <Description>理想的家庭用車,車身小巧四車門並配備車載空調,讓您的駕駛更舒適。</Description>
 <ImageURL>http://xml.rentalcars.com:80/images/car_images/D/hyundai_i20.jpg</ImageURL>
 <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/D/hyundai_i20.jpg</LargeImageURL>
 </Vehicle>
 <Price currency="USD"
   baseCurrency="CNY"
   basePrice="1734.88"


   deposit="0.00"

   baseDeposit="0.0"


   discount="33.84"


   quoteAllowed="yes"

   >282.44</Price>
  <Route>
 <PickUp>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </PickUp>
 <DropOff>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </DropOff>
 </Route>
 <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier>
  </Match>
 <Match>
 <Vehicle id="274462393"
 propositionType="BR"
 automatic="Automatic"
 aircon="Yes"
 airbag="false"
 petrol="N/A"
 group="EDAR"
 doors="4"
 seats="5"
 fuelPolicy="1"
 insurancePkg="I"
 freeCancellation="true"

 >
 <Name>Hyundai i20</Name>
 <Description>這輛經濟型轎車配備四個車門,車載空調和自動排擋,是兩個人和小型家庭出遊的理想之選。
</Description>
 <ImageURL>http://xml.rentalcars.com:80/images/car_images/D/hyundai_i20.jpg</ImageURL>
 <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/D/hyundai_i20.jpg</LargeImageURL>
 </Vehicle>
 <Price currency="USD"
   baseCurrency="CNY"
   basePrice="1816.29"


   deposit="0.00"

   baseDeposit="0.0"


   discount="35.43"


   quoteAllowed="yes"

   >295.69</Price>
  <Route>
 <PickUp>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </PickUp>
 <DropOff>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </DropOff>
 </Route>
 <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier>
  </Match>
 <Match>
 <Vehicle id="274462383"
 propositionType="BR"
 automatic="Automatic"
 aircon="Yes"
 airbag="false"
 petrol="N/A"
 group="IDAR"
 doors="4"
 seats="5"
 fuelPolicy="1"
 insurancePkg="I"
 freeCancellation="true"

 >
 <Name>Holden Cruze</Name>
 <Description>如果您和家人或者朋友們一同出遊,並想要更多的車內空間,這輛配備自動檔和車載空調的4車門汽車定能滿足您的所有要求。</Description>
 <ImageURL>http://xml.rentalcars.com:80/images/car_images/D/holden_cruze.jpg</ImageURL>
 <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/D/holden_cruze.jpg</LargeImageURL>
 </Vehicle>
 <Price currency="USD"
   baseCurrency="CNY"
   basePrice="1857.78"


   deposit="0.00"

   baseDeposit="0.0"


   discount="36.24"


   quoteAllowed="yes"

   >302.45</Price>
  <Route>
 <PickUp>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </PickUp>
 <DropOff>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </DropOff>
 </Route>
 <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier>
  </Match>
 <Match>
 <Vehicle id="274462433"
 propositionType="BR"
 automatic="Automatic"
 aircon="Yes"
 airbag="false"
 petrol="N/A"
 group="FCAR"
 doors="5"
 seats="5"
 fuelPolicy="1"
 insurancePkg="I"
 freeCancellation="true"

 >
 <Name>Volkswagen Passat</Name>
 <Description>這輛2/4車門配備車載空調的自動檔汽車為您提供寬敞的車內空間,讓您的旅途舒適愜意。</Description>
 <ImageURL>http://xml.rentalcars.com:80/images/car_images/C/vw_passat.jpg</ImageURL>
 <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/C/vw_passat.jpg</LargeImageURL>
 </Vehicle>
 <Price currency="USD"
   baseCurrency="CNY"
   basePrice="2133.14"


   deposit="0.00"

   baseDeposit="0.0"


   discount="41.61"


   quoteAllowed="yes"

   >347.28</Price>
  <Route>
 <PickUp>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </PickUp>
 <DropOff>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </DropOff>
 </Route>
 <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier>
  </Match>
 <Match>
 <Vehicle id="274462378"
 propositionType="BR"
 automatic="Automatic"
 aircon="Yes"
 airbag="false"
 petrol="N/A"
 group="SDAR"
 doors="4"
 seats="5"
 fuelPolicy="1"
 insurancePkg="I"
 freeCancellation="true"

 >
 <Name>Toyota Camry</Name>
 <Description>如果您與家人或者朋友一起出遊,那麼這輛配備自動檔和車載空調的4車門標準車型的車輛定能滿足您所有需要。</Description>
 <ImageURL>http://xml.rentalcars.com:80/images/car_images/D/toyota_camry.jpg</ImageURL>
 <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/D/toyota_camry.jpg</LargeImageURL>
 </Vehicle>
 <Price currency="USD"
   baseCurrency="CNY"
   basePrice="2148.84"


   deposit="0.00"

   baseDeposit="0.0"


   discount="41.92"


   quoteAllowed="yes"

   >349.83</Price>
  <Route>
 <PickUp>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </PickUp>
 <DropOff>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </DropOff>
 </Route>
 <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier>
  </Match>
 <Match>
 <Vehicle id="237178736"
 propositionType="BR"
 automatic="Automatic"
 aircon="Yes"
 airbag="false"
 petrol="N/A"
 group="PDAR"
 doors="5"
 seats="5"
 fuelPolicy="1"
 insurancePkg="I"
 freeCancellation="true"

 >
 <Name>Ford Falcon XR6</Name>
 <Description>如果您想要的更多?那麽這輛配備車載空調和自動檔的高級轎車就是為獨具慧眼的您準備的。</Description>
 <SpecialOfferText>可免费添加一名额外驾驶人</SpecialOfferText>
 <ImageURL>http://xml.rentalcars.com:80/images/car_images/D/ford_falcon_xr6.jpg</ImageURL>
 <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/D/ford_falcon_xr6.jpg</LargeImageURL>
 </Vehicle>
 <Price currency="USD"
   baseCurrency="CNY"
   basePrice="2378.68"


   deposit="0.00"

   baseDeposit="0.0"


   discount="46.40"


   quoteAllowed="yes"

   >387.25</Price>
  <Route>
 <PickUp>
 <Location id="804148" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </PickUp>
 <DropOff>
 <Location id="804148" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </DropOff>
 </Route>
 <Supplier long="153.03126" lat="-27.46062" small_logo="http://xml.rentalcars.com:80/images/suppliers/thrifty_logo_lrg.gif"><![CDATA[Thrifty AW]]></Supplier>
  </Match>
 <Match>
 <Vehicle id="237178696"
 propositionType="BR"
 automatic="Automatic"
 aircon="Yes"
 airbag="false"
 petrol="N/A"
 group="FDAR"
 doors="4"
 seats="5"
 fuelPolicy="1"
 insurancePkg="I"
 freeCancellation="true"

 >
 <Name>Subaru Liberty</Name>
 <Description>這輛4車門配備車載空調的自動檔汽車為您提供寬敞的車內空間,讓您的旅途舒適愜意。</Description>
 <SpecialOfferText>可免费添加一名额外驾驶人</SpecialOfferText>
 <ImageURL>http://xml.rentalcars.com:80/images/car_images/D/subaru_liberty.jpg</ImageURL>
 <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/D/subaru_liberty.jpg</LargeImageURL>
 </Vehicle>
 <Price currency="USD"
   baseCurrency="CNY"
   basePrice="2414.1"


   deposit="0.00"

   baseDeposit="0.0"


   discount="47.09"


    quoteAllowed="yes"

   >393.02</Price>
  <Route>
 <PickUp>
 <Location id="804148" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </PickUp>
 <DropOff>
 <Location id="804148" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </DropOff>
 </Route>
 <Supplier long="153.03126" lat="-27.46062" small_logo="http://xml.rentalcars.com:80/images/suppliers/thrifty_logo_lrg.gif"><![CDATA[Thrifty AW]]></Supplier>
  </Match>
 <Match>
 <Vehicle id="274462438"
 propositionType="BR"
 automatic="Automatic"
 aircon="Yes"
 airbag="false"
 petrol="N/A"
 group="IFAR"
 doors="5"
 seats="5"
 fuelPolicy="1"
 insurancePkg="I"
 freeCancellation="true"

 >
 <Name>Mitsubishi ASX</Name>
 <Description>如果您想享受與眾不同的駕駛感受,這輛配備自動檔的中型四輪驅動車是您理想之選。</Description>
 <ImageURL>http://xml.rentalcars.com:80/images/car_images/F/mitsubishi_asx.jpg</ImageURL>
 <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/F/mitsubishi_asx.jpg</LargeImageURL>
 </Vehicle>
 <Price currency="USD"
   baseCurrency="CNY"
   basePrice="2912.43"


   deposit="0.00"

   baseDeposit="0.0"


   discount="56.81"


   quoteAllowed="yes"

   >474.14</Price>
  <Route>
 <PickUp>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </PickUp>
 <DropOff>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </DropOff>
 </Route>
 <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier>
  </Match>
 <Match>
 <Vehicle id="274462458"
 propositionType="BR"
 automatic="Automatic"
 aircon="Yes"
 airbag="false"
 petrol="N/A"
 group="PCAR"
 doors="4"
 seats="5"
 fuelPolicy="1"
 insurancePkg="I"
 freeCancellation="true"

 >
 <Name>Mercedes A Class</Name>
 <Description>如果您想要的更多?那麽這輛配備車載空調和自動檔的2/4車門高級轎車就是為獨具慧眼的您準備的。</Description>
 <ImageURL>http://xml.rentalcars.com:80/images/car_images/C/mercedes_a_class.jpg</ImageURL>
 <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/C/mercedes_a_class.jpg</LargeImageURL>
 </Vehicle>
 <Price currency="USD"
   baseCurrency="CNY"
   basePrice="3284.08"


   deposit="0.00"

   baseDeposit="0.0"


   discount="64.06"


   quoteAllowed="yes"

   >534.65</Price>
  <Route>
 <PickUp>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </PickUp>
 <DropOff>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </DropOff>
 </Route>
 <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier>
  </Match>
 <Match>
 <Vehicle id="274462428"
 propositionType="BR"
 automatic="Automatic"
 aircon="Yes"
 airbag="false"
 petrol="N/A"
 group="ELAR"
 doors="3"
 seats="4"
 fuelPolicy="1"
 insurancePkg="I"
 freeCancellation="true"

 >
 <Name>Audi A1</Name>
 <Description></Description>
 <ImageURL>http://xml.rentalcars.com:80/images/car_images/L/audi_a1.jpg</ImageURL>
 <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/L/audi_a1.jpg</LargeImageURL>
 </Vehicle>
 <Price currency="USD"
   baseCurrency="CNY"
   basePrice="3289.7"


   deposit="0.00"

   baseDeposit="0.0"


   discount="64.17"


   quoteAllowed="yes"

   >535.56</Price>
  <Route>
 <PickUp>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </PickUp>
 <DropOff>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </DropOff>
 </Route>
 <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier>
  </Match>
 <Match>
 <Vehicle id="274462373"
 propositionType="BR"
 automatic="Automatic"
 aircon="Yes"
 airbag="false"
 petrol="N/A"
 group="FWAR"
 doors="4"
 seats="5"
 fuelPolicy="1"
 insurancePkg="I"
 freeCancellation="true"

 >
 <Name>Subaru Outback</Name>
 <Description>如果您想要額外的行李空間並有寬敞的家庭空間,這輛自動檔汽車是兩者的完美結合。
</Description>
 <ImageURL>http://xml.rentalcars.com:80/images/car_images/W/subaru_outback.jpg</ImageURL>
 <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/W/subaru_outback.jpg</LargeImageURL>
 </Vehicle>
 <Price currency="USD"
   baseCurrency="CNY"
   basePrice="4126.31"


   deposit="0.00"

   baseDeposit="0.0"


   discount="80.49"


   quoteAllowed="yes"

   >671.76</Price>
  <Route>
 <PickUp>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </PickUp>
 <DropOff>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </DropOff>
 </Route>
 <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier>
  </Match>
 <Match>
 <Vehicle id="274462418"
 propositionType="BR"
 automatic="Automatic"
 aircon="Yes"
 airbag="false"
 petrol="N/A"
 group="LDAR"
 doors="4"
 seats="5"
 fuelPolicy="1"
 insurancePkg="I"
 freeCancellation="true"

 >
 <Name>Audi A6</Name>
 <Description>這輛配備車載空調和自動排擋的豪華汽車,為您提供奢華的駕車享受,是您休閑或者公務旅行的首選。</Description>
 <ImageURL>http://xml.rentalcars.com:80/images/car_images/D/audi_a6.jpg</ImageURL>
 <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/D/audi_a6.jpg</LargeImageURL>
 </Vehicle>
 <Price currency="USD"
   baseCurrency="CNY"
   basePrice="4508.11"


   deposit="0.00"

   baseDeposit="0.0"


   discount="87.94"


   quoteAllowed="yes"

   >733.92</Price>
  <Route>
 <PickUp>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </PickUp>
 <DropOff>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </DropOff>
 </Route>
 <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier>
  </Match>
 <Match>
 <Vehicle id="274462403"
 propositionType="BR"
 automatic="Automatic"
 aircon="Yes"
 airbag="false"
 petrol="N/A"
 group="FFAR"
 doors="4"
 seats="5+2"
 fuelPolicy="1"
 insurancePkg="I"
 freeCancellation="true"

 >
 <Name>Mitsubishi Pajero</Name>
 <Description>如果您在尋找不同的駕駛感受,這輛配備自動檔的四輪驅動車一定能讓您的旅程充滿無限樂趣。
</Description>
 <ImageURL>http://xml.rentalcars.com:80/images/car_images/F/mitsubishi_pajero.jpg</ImageURL>
 <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/F/mitsubishi_pajero.jpg</LargeImageURL>
 </Vehicle>
 <Price currency="USD"
   baseCurrency="CNY"
   basePrice="5323.21"


   deposit="0.00"

   baseDeposit="0.0"


   discount="103.84"


   quoteAllowed="yes"

   >866.62</Price>
  <Route>
 <PickUp>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </PickUp>
 <DropOff>
 <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/>
 </DropOff>
 </Route>
 <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier>
  </Match>
 </MatchList>
</SearchRS>
';
        $simple_xml_obj = simplexml_load_string($a);
        $data_arr = SimpleXML::simplexml4array($simple_xml_obj);
        $b = 1;
        $a = 1;
    }
예제 #2
0
 /**
  *18查询门店车辆列表
  * @param $json_params
  * @return string
  */
 public static function SearchRQ($json_params)
 {
     $request_time = time();
     // 验证JSON串的正确性
     if (!empty($json_params) && IconvEncode::IsJson($json_params)) {
         // 解析Json
         $request_param = json_decode($json_params, true);
         // 验证Json串中每一组参数的正确性 [S]
         if (empty($request_param['DriverAge'])) {
             $request_param['DriverAge'] = 26;
         }
         // 验证PickUp、DropOff、DriverAge是否存在
         if (empty($request_param['PickUp']) || empty($request_param['DropOff'])) {
             $return_json = json_encode(array('status' => false, 'error_msg' => '0x180002_PickUp、DropOff、DriverAge不可为空'));
             return $return_json;
         }
         // DriverAge只能是大于0小于100的数字
         if (!is_numeric($request_param['DriverAge']) || $request_param['DriverAge'] <= 18 || $request_param['DriverAge'] >= 75) {
             $return_json = json_encode(array('status' => false, 'error_msg' => '0x180003_DriverAge只能是大于18小于75的数字'));
             return $return_json;
         }
         // 声明简短变量
         $PickUp_Location = empty($request_param['PickUp']['Location']) ? '' : $request_param['PickUp']['Location'];
         // PickUp.Location
         $DropOff_Location = empty($request_param['DropOff']['Location']) ? '' : $request_param['DropOff']['Location'];
         // DropOff.Location
         $PickUp_Date = empty($request_param['PickUp']['Date']) ? '' : $request_param['PickUp']['Date'];
         // PickUp.Date
         $DropOff_Date = empty($request_param['DropOff']['Date']) ? '' : $request_param['DropOff']['Date'];
         // DropOff.Date
         // 验证PickUp与DropOff下的 Location与Date是否存在
         if (empty($PickUp_Location) || empty($PickUp_Date) || empty($DropOff_Location) || empty($DropOff_Date)) {
             $return_json = json_encode(array('status' => false, 'error_msg' => '0x180004_PickUp与DropOff下的 Location与Date是否存在'));
             return $return_json;
         }
         // Location下正确的参数名
         $Location_Key = array('id', 'country', 'city');
         // 验证PickUp.Location 中的参数名是否正确
         foreach ($PickUp_Location as $key => $val) {
             if (!in_array($key, $Location_Key)) {
                 $return_json = json_encode(array('status' => false, 'error_msg' => '0x180005_PickUp. Location 下的参数名错误'));
                 return $return_json;
             }
         }
         // 验证DropOff.Location 中的参数名是否正确
         foreach ($DropOff_Location as $key => $val) {
             if (!in_array($key, $Location_Key)) {
                 $return_json = json_encode(array('status' => false, 'error_msg' => '0x180006_DropOff. Location 下的参数名错误'));
                 return $return_json;
             }
         }
         // 验证PickUp.Location 中是否为填写任何条件 [id / country / city]
         if (count($PickUp_Location) == 0) {
             $return_json = json_encode(array('status' => false, 'error_msg' => '0x180007_PickUp. Location 下缺少必填参数'));
             return $return_json;
         } else {
             // 如按国家+城市的方式查询
             if (empty($PickUp_Location['id'])) {
                 // country与city不能单独使用 如填写了country或city的其中一个 另一个也必须填写
                 if (empty($PickUp_Location['country']) && !empty($PickUp_Location['city']) || !empty($PickUp_Location['country']) && empty($PickUp_Location['city'])) {
                     $return_json = json_encode(array('status' => false, 'error_msg' => '0x180008_单独使用了PickUp.Location 下的country或city'));
                     return $return_json;
                 }
             }
         }
         // 验证DropOff.Location 中是否为填写任何条件 [id / country / city]
         if (count($DropOff_Location) == 0) {
             $return_json = json_encode(array('status' => false, 'error_msg' => '0x180009_DropOff. Location 下缺少必填参数'));
             return $return_json;
         } else {
             // 如按国家+城市的方式查询
             if (empty($DropOff_Location['id'])) {
                 // country与city不能单独使用 如填写了country或city的其中一个 另一个也必须填写
                 if (empty($DropOff_Location['country']) && !empty($DropOff_Location['city']) || !empty($DropOff_Location['country']) && empty($DropOff_Location['city'])) {
                     $return_json = json_encode(array('status' => false, 'error_msg' => '0x180010_单独使用了DropOff.Location 下的country或city'));
                     return $return_json;
                 }
             }
         }
         // PickUp.Date 中的参数均为必填项
         if (empty($PickUp_Date['year']) || empty($PickUp_Date['month']) || empty($PickUp_Date['day']) || empty($PickUp_Date['hour']) || empty($PickUp_Date['minute'])) {
             $return_json = json_encode(array('status' => false, 'error_msg' => '0x180011_PickUp.Date下缺少必填参数'));
             return $return_json;
         }
         // DropOff.Date 中的参数均为必填项
         if (empty($DropOff_Date['year']) || empty($DropOff_Date['month']) || empty($DropOff_Date['day']) || empty($DropOff_Date['hour']) || empty($DropOff_Date['minute'])) {
             $return_json = json_encode(array('status' => false, 'error_msg' => '0x180012_DropOff.Date 下缺少必填参数'));
             return $return_json;
         }
         $start_time = strtotime($PickUp_Date['year'] . '-' . $PickUp_Date['month'] . '-' . $PickUp_Date['day'] . ' ' . $PickUp_Date['hour'] . ':' . $DropOff_Date['minute']);
         $end_time = strtotime($DropOff_Date['year'] . '-' . $DropOff_Date['month'] . '-' . $DropOff_Date['day'] . ' ' . $DropOff_Date['hour'] . ':' . $DropOff_Date['minute']);
         // 验证时间范围是否正确 [例:2014-13-38 错误时间strtotime会返回false]
         if ($start_time && $end_time) {
             // 结束时间不能小于开始时间
             if ($end_time < $start_time) {
                 $return_json = json_encode(array('status' => false, 'error_msg' => '0x180014_DropOff.Date 小于了PickUp.Date'));
                 return $return_json;
             }
         } else {
             $return_json = json_encode(array('status' => false, 'error_msg' => '0x180013_PickUp.Date或DropOff.Date不是正确的时间'));
             return $return_json;
         }
         // 验证Json串中每一组参数的正确性 [E]
         // 判断根据ID查询还是根据国家地区查询
         $PickUp_Location = empty($request_param['PickUp']['Location']['id']) ? 'country="' . $request_param['PickUp']['Location']['country'] . '" city="' . $request_param['PickUp']['Location']['city'] . '"' : 'id="' . $request_param['PickUp']['Location']['id'] . '"';
         $DropOff_Location = empty($request_param['DropOff']['Location']['id']) ? 'country="' . $request_param['DropOff']['Location']['country'] . '" city="' . $request_param['DropOff']['Location']['city'] . '"' : 'id="' . $request_param['DropOff']['Location']['id'] . '"';
         //remoteIp 得到客户端ip
         $remoteIp = !empty($request_param['remoteIp']) ? $request_param['remoteIp'] : CARRENTALAPI_REMOTEIP;
         if (!filter_var($remoteIp, FILTER_VALIDATE_IP)) {
             $return_json = json_encode(array('status' => false, 'error_msg' => '0x180015_remoteIp不是正确ip地址'));
             return $return_json;
         }
         // 拼接XML <SearchRQ supplierInfo="true" showReviews="true" >
         $request_xml = '
                     <SearchRQ  supplierInfo="true" prefcurr="USD">
                         <Credentials username="******" password="******" remoteIp="' . $remoteIp . '" />
                         <PickUp>
                             <Location ' . $PickUp_Location . '/>
                             <Date year="' . $request_param['PickUp']['Date']['year'] . '" month="' . $request_param['PickUp']['Date']['month'] . '" day="' . $request_param['PickUp']['Date']['day'] . '" hour="' . $request_param['PickUp']['Date']['hour'] . '" minute="' . $request_param['PickUp']['Date']['minute'] . '"/>
                         </PickUp>
                         <DropOff>
                             <Location ' . $DropOff_Location . '/>
                             <Date year="' . $request_param['DropOff']['Date']['year'] . '" month="' . $request_param['DropOff']['Date']['month'] . '" day="' . $request_param['DropOff']['Date']['day'] . '" hour="' . $request_param['DropOff']['Date']['hour'] . '" minute="' . $request_param['DropOff']['Date']['minute'] . '"/>
                         </DropOff>
                         <DriverAge>' . $request_param['DriverAge'] . '</DriverAge>
                         <Tracking adcamp="example" adplat="example"/>
                     </SearchRQ>';
         // 调用接口获取数据
         $request_data = array('xml' => $request_xml);
         $searchRQ = GetUrlContent::fileGetContent($request_data, CARRENTALAPI_URL, 100, 'POST');
         // $searchRQ='<SearchRS> <MatchList> </MatchList></SearchRS>';
         // ApiLogManage::addRentalcars('SearchRQ_once',$request_xml,$searchRQ,'',$request_time,time(),1);//记录日志
         $simple_xml_obj = simplexml_load_string($searchRQ);
         if (!$simple_xml_obj) {
             //判断数据是否为空
             $return_json = json_encode(array('status' => false, 'error_msg' => '0x180099_返回数据为空或生成xml对象数据为false'));
             return $return_json;
         }
         $data_arr = SimpleXML::simplexml4array($simple_xml_obj);
         if (!empty($data_arr['SearchRS'][0]['MatchList']) && isset($data_arr['SearchRS'][0]['MatchList'])) {
             $result_arr = $data_arr['SearchRS'][0]['MatchList'];
             if (!is_array($result_arr[0]['Match'])) {
                 //判断是否有车辆
                 $return_json = json_encode(array('status' => false, 'error_msg' => '0x180099_返回数据为空或生成xml对象数据为false'));
                 return $return_json;
             }
         }
         //对数据进行处理[S]
         $result_arr = self::filterArray($result_arr);
         //过滤中间层
         //下载rentalcars图片到本地
         /* ini_set('display_errors', 'On');// 显示所有错误
            error_reporting(E_ALL);*/
         foreach ($result_arr as &$match) {
             if (isset($match['Match'])) {
                 //处理车辆图片[S]
                 $oldImageURL = $match['Match']['Vehicle']['ImageURL']['@text'];
                 $parse_oldImageURL = parse_url($oldImageURL);
                 $newImageFile = CARRENTAL_IMAGES_PATH . $parse_oldImageURL['path'];
                 if (!file_exists($newImageFile)) {
                     $match['Match']['Vehicle']['ImageURL']['@text'] = HTTP_URL . GetUrlContent::GrabImage($oldImageURL, $newImageFile);
                 } else {
                     $match['Match']['Vehicle']['ImageURL']['@text'] = HTTP_URL . $newImageFile;
                 }
                 $oldLargeImageURL = $match['Match']['Vehicle']['LargeImageURL']['@text'];
                 $parse_oldLargeImageURL = parse_url($oldLargeImageURL);
                 $newLargeImageFile = CARRENTAL_IMAGES_PATH . $parse_oldLargeImageURL['path'];
                 if (!file_exists($newLargeImageFile)) {
                     $match['Match']['Vehicle']['LargeImageURL']['@text'] = HTTP_URL . GetUrlContent::GrabImage($oldLargeImageURL, $newLargeImageFile);
                 } else {
                     $match['Match']['Vehicle']['LargeImageURL']['@text'] = HTTP_URL . $newLargeImageFile;
                 }
                 //处理车辆图片[E]
                 //处理车辆公司logo[S]
                 $oldSmall_logo = $match['Match']['Supplier']['@attributes']['small_logo'];
                 $parse_oldSmall_logo = parse_url($oldSmall_logo);
                 $newSmall_logo = CARRENTAL_IMAGES_PATH . $parse_oldSmall_logo['path'];
                 if (!file_exists($newSmall_logo)) {
                     $match['Match']['Supplier']['@attributes']['small_logo'] = HTTP_URL . GetUrlContent::GrabImage($oldSmall_logo, $newSmall_logo);
                 } else {
                     $match['Match']['Supplier']['@attributes']['small_logo'] = HTTP_URL . $newSmall_logo;
                 }
                 //处理车辆公司logo[E]
             }
         }
         //对数据进行处理[E]
         $result = json_encode($result_arr);
         if (!empty($result)) {
             $return_json = json_encode(array('status' => true, 'data' => $result_arr));
             ApiLogManage::addRentalcars('SearchRQ', $json_params, $searchRQ, $return_json, $request_time, time(), 1);
             //记录日志
             return $return_json;
         } else {
             $return_json = json_encode(array('status' => false, 'error_msg' => '0x180099_请求超时'));
             ApiLogManage::addRentalcars('SearchRQ', $json_params, $searchRQ, $return_json, $request_time, time(), 10);
             //记录日志
             return $return_json;
             //请求超时
         }
     } else {
         $return_json = json_encode(array('status' => false, 'error_msg' => '0x180001_JSON参数格式错误'));
         return $return_json;
     }
 }
예제 #3
0
 /**
  * 18查询租车信息
  * @return String
  * 错误代码:[1.JSON参数格式错误 / 2.PickUp或DropOff或DriverAge 的参数名错误 / 3.DriverAge的参数错误 / 4.PickUp或DropOff下 缺少Location或Date参数 / 5.PickUp. Location 下的参数名错误
  *          6.DropOff. Location 下的参数名错误 / 7.PickUp. Location 下缺少必填参数 / 8.单独使用了PickUp.Location 下的country或city / 9.DropOff. Location 下缺少必填参数 /
  *          10.单独使用了DropOff.Location 下的country或city / 11.PickUp.Date下缺少必填参数 / 12.DropOff.Date 下缺少必填参数 / 13.PickUp.Date或DropOff.Date不是正确的时间 / 14.DropOff.Date 小于了 PickUp.Date]
  */
 public function actionSearchRQ()
 {
     $request_time = time();
     $json_params = Yii::app()->request->getParam('json_params');
     //客户端请求的json参数
     //        $json_params = '{"PickUp":{"Location":{"id":"1124991"},"Date":{"year":"2014","month":"12","day":"12","hour":"12","minute":"30"}},"DropOff":{"Location":{"id":"1124991"},"Date":{"year":"2014","month":"12","day":"30","hour":"12","minute":"30"}},"DriverAge":"32"}';
     // 验证JSON串的正确性
     if (!empty($json_params) && IconvEncode::IsJson($json_params)) {
         // 解析Json
         $request_param = json_decode($json_params, true);
         // 验证Json串中每一组参数的正确性 [S]
         // 验证PickUp、DropOff、DriverAge是否存在
         if (empty($request_param['PickUp']) || empty($request_param['DropOff']) || empty($request_param['DriverAge'])) {
             $return_json = json_encode(array('status' => false, 'error_msg' => '2_PickUp、DropOff、DriverAge不可为空'));
             exit($return_json);
         }
         // DriverAge只能是大于0小于100的数字
         if (!is_numeric($request_param['DriverAge']) || $request_param['DriverAge'] <= 18 || $request_param['DriverAge'] >= 75) {
             $return_json = json_encode(array('status' => false, 'error_msg' => '3_DriverAge只能是大于18小于75的数字'));
             exit($return_json);
         }
         // 声明简短变量
         $PickUp_Location = empty($request_param['PickUp']['Location']) ? '' : $request_param['PickUp']['Location'];
         // PickUp.Location
         $DropOff_Location = empty($request_param['DropOff']['Location']) ? '' : $request_param['DropOff']['Location'];
         // DropOff.Location
         $PickUp_Date = empty($request_param['PickUp']['Date']) ? '' : $request_param['PickUp']['Date'];
         // PickUp.Date
         $DropOff_Date = empty($request_param['DropOff']['Date']) ? '' : $request_param['DropOff']['Date'];
         // DropOff.Date
         // 验证PickUp与DropOff下的 Location与Date是否存在
         if (empty($PickUp_Location) || empty($PickUp_Date) || empty($DropOff_Location) || empty($DropOff_Date)) {
             $return_json = json_encode(array('status' => false, 'error_msg' => '4_PickUp与DropOff下的 Location与Date是否存在'));
             exit($return_json);
         }
         // Location下正确的参数名
         $Location_Key = array('id', 'country', 'city');
         // 验证PickUp.Location 中的参数名是否正确
         foreach ($PickUp_Location as $key => $val) {
             if (!in_array($key, $Location_Key)) {
                 $return_json = json_encode(array('status' => false, 'error_msg' => '5_PickUp. Location 下的参数名错误'));
                 exit($return_json);
             }
         }
         // 验证DropOff.Location 中的参数名是否正确
         foreach ($DropOff_Location as $key => $val) {
             if (!in_array($key, $Location_Key)) {
                 $return_json = json_encode(array('status' => false, 'error_msg' => '6_DropOff. Location 下的参数名错误'));
                 exit($return_json);
             }
         }
         // 验证PickUp.Location 中是否为填写任何条件 [id / country / city]
         if (count($PickUp_Location) == 0) {
             $return_json = json_encode(array('status' => false, 'error_msg' => '7_PickUp. Location 下缺少必填参数'));
             exit($return_json);
         } else {
             // 如按国家+城市的方式查询
             if (empty($PickUp_Location['id'])) {
                 // country与city不能单独使用 如填写了country或city的其中一个 另一个也必须填写
                 if (empty($PickUp_Location['country']) && !empty($PickUp_Location['city']) || !empty($PickUp_Location['country']) && empty($PickUp_Location['city'])) {
                     $return_json = json_encode(array('status' => false, 'error_msg' => '8_单独使用了PickUp.Location 下的country或city'));
                     exit($return_json);
                 }
             }
         }
         // 验证DropOff.Location 中是否为填写任何条件 [id / country / city]
         if (count($DropOff_Location) == 0) {
             $return_json = json_encode(array('status' => false, 'error_msg' => '9_DropOff. Location 下缺少必填参数'));
             exit($return_json);
         } else {
             // 如按国家+城市的方式查询
             if (empty($DropOff_Location['id'])) {
                 // country与city不能单独使用 如填写了country或city的其中一个 另一个也必须填写
                 if (empty($DropOff_Location['country']) && !empty($DropOff_Location['city']) || !empty($DropOff_Location['country']) && empty($DropOff_Location['city'])) {
                     $return_json = json_encode(array('status' => false, 'error_msg' => '10_单独使用了DropOff.Location 下的country或city'));
                     exit($return_json);
                 }
             }
         }
         // PickUp.Date 中的参数均为必填项
         if (empty($PickUp_Date['year']) || empty($PickUp_Date['month']) || empty($PickUp_Date['day']) || empty($PickUp_Date['hour']) || empty($PickUp_Date['minute'])) {
             $return_json = json_encode(array('status' => false, 'error_msg' => '11_PickUp.Date下缺少必填参数'));
             exit($return_json);
         }
         // DropOff.Date 中的参数均为必填项
         if (empty($DropOff_Date['year']) || empty($DropOff_Date['month']) || empty($DropOff_Date['day']) || empty($DropOff_Date['hour']) || empty($DropOff_Date['minute'])) {
             $return_json = json_encode(array('status' => false, 'error_msg' => '12_DropOff.Date 下缺少必填参数'));
             exit($return_json);
         }
         $start_time = strtotime($PickUp_Date['year'] . '-' . $PickUp_Date['month'] . '-' . $PickUp_Date['day'] . ' ' . $PickUp_Date['hour'] . ':' . $DropOff_Date['minute']);
         $end_time = strtotime($DropOff_Date['year'] . '-' . $DropOff_Date['month'] . '-' . $DropOff_Date['day'] . ' ' . $DropOff_Date['hour'] . ':' . $DropOff_Date['minute']);
         // 验证时间范围是否正确 [例:2014-13-38 错误时间strtotime会返回false]
         if ($start_time && $end_time) {
             // 结束时间不能小于开始时间
             if ($end_time < $start_time) {
                 $return_json = json_encode(array('status' => false, 'error_msg' => '14_DropOff.Date 小于了PickUp.Date'));
                 exit($return_json);
             }
         } else {
             $return_json = json_encode(array('status' => false, 'error_msg' => '13_PickUp.Date或DropOff.Date不是正确的时间'));
             exit($return_json);
         }
         // 验证Json串中每一组参数的正确性 [E]
         // 判断根据ID查询还是根据国家地区查询
         $PickUp_Location = empty($request_param['PickUp']['Location']['id']) ? 'country="' . $request_param['PickUp']['Location']['country'] . '" city="' . $request_param['PickUp']['Location']['city'] . '"' : 'id="' . $request_param['PickUp']['Location']['id'] . '"';
         $DropOff_Location = empty($request_param['DropOff']['Location']['id']) ? 'country="' . $request_param['DropOff']['Location']['country'] . '" city="' . $request_param['DropOff']['Location']['city'] . '"' : 'id="' . $request_param['DropOff']['Location']['id'] . '"';
         // 拼接XML
         $request_xml = '
                     <SearchRQ>
                         <Credentials username="******" password="******" remoteIp="' . CARRENTALAPI_REMOTEIP . '" />
                         <PickUp>
                             <Location ' . $PickUp_Location . '/>
                             <Date year="' . $request_param['PickUp']['Date']['year'] . '" month="' . $request_param['PickUp']['Date']['month'] . '" day="' . $request_param['PickUp']['Date']['day'] . '" hour="' . $request_param['PickUp']['Date']['hour'] . '" minute="' . $request_param['PickUp']['Date']['minute'] . '"/>
                         </PickUp>
                         <DropOff>
                             <Location ' . $DropOff_Location . '/>
                             <Date year="' . $request_param['DropOff']['Date']['year'] . '" month="' . $request_param['DropOff']['Date']['month'] . '" day="' . $request_param['DropOff']['Date']['day'] . '" hour="' . $request_param['DropOff']['Date']['hour'] . '" minute="' . $request_param['DropOff']['Date']['minute'] . '"/>
                         </DropOff>
                         <DriverAge>' . $request_param['DriverAge'] . '</DriverAge>
                         <Tracking adcamp="example" adplat="example"/>
                     </SearchRQ>';
         // 调用接口获取数据
         $request_data = array('xml' => $request_xml);
         $searchRQ = GetUrlContent::fileGetContent($request_data, CARRENTALAPI_URL, 30, 'POST');
         $simple_xml_obj = simplexml_load_string($searchRQ);
         $data_arr = SimpleXML::simplexml4array($simple_xml_obj);
         if (!empty($data_arr['SearchRS'][0]['MatchList']) && isset($data_arr['SearchRS'][0]['MatchList'])) {
             $result_arr = $data_arr['SearchRS'][0]['MatchList'];
         }
         $result = json_encode($result_arr);
         if (!empty($result)) {
             $return_json = json_encode(array('status' => true, 'data' => $result_arr));
             ApiLogManage::addRentalcars('SearchRQ', $json_params, $searchRQ, $return_json, $request_time, time(), 1);
             //记录日志
             echo $return_json;
             exit;
         } else {
             $return_json = json_encode(array('status' => false, 'error_msg' => '5_请求超时'));
             ApiLogManage::addRentalcars('SearchRQ', $json_params, $searchRQ, $return_json, $request_time, time(), 10);
             //记录日志
             exit($return_json);
             //请求超时
         }
     } else {
         $return_json = json_encode(array('status' => false, 'error_msg' => '1_JSON参数格式错误'));
         exit($return_json);
     }
 }