私がこの権利について行っているかどうかはわかりません。フィードから xml を取得し、それを php 文字列 $rawdata データのように含める cURL スクリプトがあります...
<search>
<response status="1">
<errors>
<number_of_hotels>1 of 1</number_of_hotels>
</errors>
</response>
<lr_rates>
<hotel>
<hotel_ref>142680</hotel_ref>
<hotel_currency>GBP</hotel_currency>
<hotel_rooms>
<room>
<ref>4380316</ref>
<type>10</type>
<type_description>Apartment</type_description>
<sleeps>2</sleeps>
<rooms_available>0</rooms_available>
<adults>2</adults>
<children>0</children>
<breakfast>false</breakfast>
<dinner>false</dinner>
<description>The apartment has seperate kitchen area, lounge/dining area, bedroom with double bed and bathroom with bath & shower.</description>
<alternate_description/>
<rack_rate>140.00</rack_rate>
<rate>
<date>31/07/2012</date>
<formatted_date>31 July 2012</formatted_date>
<price>Full</price>
<hotelcurrencyprice>Full</hotelcurrencyprice>
<numeric_price>Full</numeric_price>
<numeric_hotelcurrencyprice>Full</numeric_hotelcurrencyprice>
<requested_currency>GBP</requested_currency>
</rate>
<rate>
<date>01/08/2012</date>
<formatted_date>01 August 2012</formatted_date>
<price>Full</price>
<hotelcurrencyprice>Full</hotelcurrencyprice>
<numeric_price>Full</numeric_price>
<numeric_hotelcurrencyprice>Full</numeric_hotelcurrencyprice>
<requested_currency>GBP</requested_currency>
</rate>
<available_online>false</available_online>
<minimum_nights>1</minimum_nights>
<bed_type>Double</bed_type>
<cancellation_policy/>
<cancellation_days/>
<cancellation_hours/>
<room_terms/>
</room>
<room>
<ref>4383781</ref>
<type>10</type>
<type_description>Apartment</type_description>
<sleeps>4</sleeps>
<rooms_available>0</rooms_available>
<adults>4</adults>
<children>0</children>
<breakfast>false</breakfast>
<dinner>false</dinner>
<description>The apartment has seperate kitchen area, lounge with dining area, two double bedrooms, ensuite & main bathroom.</description>
<alternate_description/>
<rack_rate>185.00</rack_rate>
<rate>
<date>31/07/2012</date>
<formatted_date>31 July 2012</formatted_date>
<price>Full</price>
<hotelcurrencyprice>Full</hotelcurrencyprice>
<numeric_price>Full</numeric_price>
<numeric_hotelcurrencyprice>Full</numeric_hotelcurrencyprice>
<requested_currency>GBP</requested_currency>
</rate>
<rate>
<date>01/08/2012</date>
<formatted_date>01 August 2012</formatted_date>
<price>Full</price>
<hotelcurrencyprice>Full</hotelcurrencyprice>
<numeric_price>Full</numeric_price>
<numeric_hotelcurrencyprice>Full</numeric_hotelcurrencyprice>
<requested_currency>GBP</requested_currency>
</rate>
<available_online>false</available_online>
<minimum_nights>1</minimum_nights>
<bed_type/>
<cancellation_policy/>
<cancellation_days/>
<cancellation_hours/>
<room_terms/>
</room>
</hotel_rooms>
<cancellation_type>First Night Stay Chargeable</cancellation_type>
<cancellation_policy>1 Days Prior to Arrival</cancellation_policy>
<citytax>
<typename/>
<value/>
<optedin/>
<iscitytaxarea/>
</citytax>
</hotel>
</lr_rates>
</search>
可能な場合はphpに戻す必要がある他の情報と価格のインスタンスが複数あります.................OKなので答えはい、可能ですが、xslを取得して部屋のデータを出力しようとして立ち往生しているので、最初にphpインストールを再構築してxslを含める必要がありました。次に、このphpを使用して出力を取得しました。それをすべて呼び出します:
$ch = curl_init();
$timeout = 0;
curl_setopt ($ch, CURLOPT_URL, $url1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT , "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)");
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$rawdata = curl_exec($ch);
curl_close($ch);
$xml = new DOMDocument();
$xml->$rawdata;
$xsl = new DOMDocument;
$xsl->load('path/to/file.xsl');
$proc = new XSLTProcessor();
$proc->importStyleSheet($xsl);
$lrdata = $proc->transformToXML($xml);
すべてが機能するようになりましたが、xslt で各ルーム ノードからデータを取得することはできません。マッチと選択の値を変更しようとしましたが、xml が上記と同じであると仮定すると、ここで何が間違っているのでしょうか。これは xsl です。
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<h2> Availability Search:</h2>
<table border="1">
<tr bgcolor="#FFFFFF">
<th align="left">Room Type</th>
<th align="left">Description</th>
<th align="left">Availability</th>
<th align="left">Price</th>
</tr>
<xsl:for-each select="/room">
<tr>
<td><xsl:value-of select="type_description" /></td>
<td><xsl:value-of select="description" /></td>
<td><xsl:value-of select="rooms_available" /></td>
<td><xsl:value-of select="rack_rate" /></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
混乱して申し訳ないので、この xsl で何が間違っているのか、情報を $string として php に戻すことができるかどうかを知る必要があります。