Right.
Im trying to communicate with the expedia travel API, exchanging xml feed with them.
It goes somehow like this:
I send them info of the query I want, they send me the query back in xml form.
Here is an example of a query I would want to send them:
http:/api.ean.com/ean-services/rs/hotel/v3/list?minorRev=5&cid=55505&apiKey=4zckao5ucpwuabf3egk25bt7&customerUserAgent=[xxx]&customerIpAddress=172.1682.13&locale=en_US¤cyCode=USD&xml=<HotelListRequest><city>Seattle</city><stateProvinceCode>WA</stateProvinceCode><countryCode>US</countryCode><arrivalDate>08/01/2011</arrivalDate><departureDate>08/03/2011</departureDate><RoomGroup><Room><numberOfAdults>2</numberOfAdults></Room></RoomGroup><numberOfResults>1</numberOfResults></HotelListRequest>
Notice if you put that into the urlbar of your browser, you get an xml feed on the screen. (I have changed the apiKey, so all you get is Developer Inactive), in reality you would get an xml feed like this:
<ns2:HotelListResponse>
<customerSessionId>0ABAA856-94D0-1913-0762-FCBF069040C5</customerSessionId>
<numberOfRoomsRequested>1</numberOfRoomsRequested>
<moreResultsAvailable>true</moreResultsAvailable>
<cacheKey>-24c94d01:13076fcbf06:-40c3</cacheKey>
<cacheLocation>10.186.168.86:7302</cacheLocation>
−
<HotelList activePropertyCount="231" size="1">
−
<HotelSummary order="0">
<hotelId>176580</hotelId>
<name>Best Western Airport Executel</name>
<address1>20717 International Blvd</address1>
<city>SeaTac</city>
<stateProvinceCode>WA</stateProvinceCode>
<postalCode>98198</postalCode>
<countryCode>US</countryCode>
<airportCode>SEA</airportCode>
<supplierType>E</supplierType>
<propertyCategory>1</propertyCategory>
<hotelRating>2.5</hotelRating>
<confidenceRating>78</confidenceRating>
<amenityMask>165374346</amenityMask>
<tripAdvisorRating>3.5</tripAdvisorRating>
<locationDescription>Near the airport</locationDescription>
−
<shortDescription>
<p><strong>Location.</strong> <br />Located in SeaTac, Best Western Airport Executel is near the airport and close to Hydroplane and Raceboat Museum. Other points of interest are ShoWare Center and
</shortDescription>
<highRate>80.09</highRate>
<lowRate>80.09</lowRate>
<rateCurrencyCode>USD</rateCurrencyCode>
<latitude>47.41617</latitude>
<longitude>-122.29722</longitude>
<proximityDistance>15.536363</proximityDistance>
<proximityUnit>MI</proximityUnit>
<hotelInDestination>true</hotelInDestination>
<thumbNailUrl>/hotels/1000000/30000/22900/22893/22893_61_t.jpg</thumbNailUrl>
−
<deepLink>
http://travel.ian.com/index.jsp?pageName=hotAvail&cid=55505&hotelID=176580&mode=2&numberOfRooms=1&room-0-adult-total=2&room-0-child-total=0&arrivalMonth=7&arrivalDay=1&departureMonth=7&departureDay=3&showInfo=true&locale=en_US&currencyCode=USD
</deepLink>
−
<RoomRateDetailsList>
−
<RoomRateDetails>
<roomTypeCode>16240</roomTypeCode>
<rateCode>200058358</rateCode>
<maxRoomOccupancy>3</maxRoomOccupancy>
<quotedRoomOccupancy>2</quotedRoomOccupancy>
<minGuestAge>0</minGuestAge>
<roomDescription>Standard Room Queen Bed-NonRefundable</roomDescription>
<currentAllotment>13</currentAllotment>
<propertyAvailable>true</propertyAvailable>
<propertyRestricted>false</propertyRestricted>
<expediaPropertyId>22893</expediaPropertyId>
<rateKey>c1e905de-4084-48e1-a607-081b74148642</rateKey>
−
<RateInfo rateChange="false" promo="false" priceBreakdown="true">
−
<ChargeableRateInfo commissionableUsdTotal="160.18" total="183.88" surchargeTotal="23.7" nightlyRateTotal="160.18" averageBaseRate="80.09" averageRate="80.09" maxNightlyRate="80.09" currencyCode="USD">
−
<NightlyRatesPerRoom size="2">
<NightlyRate promo="false" rate="80.09" baseRate="80.09"/>
<NightlyRate promo="false" rate="80.09" baseRate="80.09"/>
</NightlyRatesPerRoom>
−
<Surcharges size="1">
<Surcharge amount="23.7" type="TaxAndServiceFee"/>
</Surcharges>
</ChargeableRateInfo>
</RateInfo>
−
<ValueAdds size="3">
−
<ValueAdd id="2">
<description>Continental Breakfast</description>
</ValueAdd>
−
<ValueAdd id="32768">
<description>Free Airport Shuttle</description>
</ValueAdd>
−
<ValueAdd id="1024">
<description>Free High-Speed Internet</description>
</ValueAdd>
</ValueAdds>
</RoomRateDetails>
</RoomRateDetailsList>
</HotelSummary>
</HotelList>
</ns2:HotelListResponse>
The thing is though, I want to send this feed to the server(not redirect the page), and then read the xml data and post it on the screen in my application. For an easy example, how would I go about extracting the name of the hotel and the price.
I tried loading the xml by putting the xml request(what you put in the url bar) into a variable called $query.
And then:
$doc = new DOMDocument();
$doc->load($query);
But I get an error saying something like:
Warning: DOMDocument::load() [domdocument.load]: I/O warning : failed to load external entity "http:/api.ean.com/ean-services/rs/hotel/v3/list?minorRev=5bla bla.
Any ideas?