मैं एक सोप सेवा करने के लिए एक अनुरोध भेजने के लिए cURL उपयोग कर रहा हूँ करने के लिए सोप XML प्रतिक्रिया परिवर्तित, मैं पैरामीटर युक्त एक्सएमएल पोस्ट शरीर में भेजने के लिए, जवाब में मैं प्राप्त करते हैं:एक PHP वस्तु या सरणी
वेब सेवा: http://lcbtestxmlv2.ivector.co.uk/soap/book.asmx?WSDL
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<SearchResponse xmlns="http://ivectorbookingxml/">
<SearchResult>
<ReturnStatus>
<Success>true</Success>
<Exception />
</ReturnStatus>
<SearchURL>http://www.lowcostholidays.fr/dl.aspx?p=0,8,5,0&date=10/05/2013&duration=15&room1=2,1,0_5&regionid=9</SearchURL>
<PropertyResults>
<PropertyResult>
<TotalProperties>215</TotalProperties>
<PropertyID>1795</PropertyID>
<PropertyName>Hotel Gaddis</PropertyName>
<Rating>3.0</Rating>
<Country>Egypte</Country>
<Resort>Louxor</Resort>
<Strapline>Cet établissement confortable propose un très bon service à un bon rapport qualité-prix. Cet hôtel de 6 étages compte 55 chambres et comprend une terrasse, une réception avec coffre-fort et ascenseur,</Strapline>
<Description>Cet établissement confortable propose un très bon service à un bon rapport qualité-prix. Cet hôtel de 6 étages compte 55 chambres et comprend une terrasse, une réception avec coffre-fort et ascenseur,...</Description>
<CMSBaseURL>http://lcbtestxml1.ivector.co.uk/content/DataObjects/Property/Image/</CMSBaseURL>
<MainImage>image_1795_v1.jpg</MainImage>
<MainImageThumbnail>imagethumb_1795_v1.jpg</MainImageThumbnail>
<SearchURL>http://www.lowcostholidays.fr/dl.aspx?p=0,8,5,0&date=10/05/2013&duration=15&room1=2,1,0_5&regionid=9&propertyid=1795</SearchURL>
<RoomTypes>
<RoomType>
<Seq>1</Seq>
<PropertyRoomTypeID>690039000</PropertyRoomTypeID>
<MealBasisID>3</MealBasisID>
<RoomType>Twin/double Room</RoomType>
<RoomView />
<MealBasis>Petit Déjeuner</MealBasis>
<NonRefundableRates>false</NonRefundableRates>
<SubTotal>150.58</SubTotal>
<Discount>0</Discount>
<Total>150.58</Total>
<Adults>2</Adults>
<Children>1</Children>
<Infants>0</Infants>
<Errata />
</RoomType>
<RoomType>
<Seq>1</Seq>
<PropertyRoomTypeID>690039001</PropertyRoomTypeID>
<MealBasisID>7</MealBasisID>
<RoomType>Twin/double Room</RoomType>
<RoomView />
<MealBasis>Demi-Pension</MealBasis>
<NonRefundableRates>false</NonRefundableRates>
<SubTotal>291.64</SubTotal>
<Discount>0</Discount>
<Total>291.64</Total>
<Adults>2</Adults>
<Children>1</Children>
<Infants>0</Infants>
<Errata />
</RoomType>
<RoomType>
<Seq>1</Seq>
<PropertyRoomTypeID>690039002</PropertyRoomTypeID>
<MealBasisID>5</MealBasisID>
<RoomType>Double/twin Room</RoomType>
<RoomView />
<MealBasis>Pension Complète</MealBasis>
<NonRefundableRates>false</NonRefundableRates>
<SubTotal>529.22</SubTotal>
<Discount>0</Discount>
<Total>529.22</Total>
<Adults>2</Adults>
<Children>1</Children>
<Infants>0</Infants>
<Errata />
</RoomType>
</RoomTypes>
</PropertyResult>
</PropertyResults>
</SearchResult>
</SearchResponse>
</soap:Body>
</soap:Envelope>
मेरे पास XML डेटा के साथ पर्याप्त अनुभव नहीं है। मैंने एक्सएमएल प्रतिक्रिया को PHP ऑब्जेक्ट या सरणी में बदलने की कोशिश करने में घंटों बिताए, लेकिन बिना किसी सफलता के।
मुझे सभी संपत्ति समीक्षा पढ़ने की आवश्यकता है।
पीएचपी कोड:
$xml = simplexml_load_string($soap_xml_result);
$xml->registerXPathNamespace('soap', 'http://schemas.xmlsoap.org/soap/envelope/');
$xml->registerXPathNamespace('xsi', 'http://www.w3.org/2001/XMLSchema-instance');
$xml->registerXPathNamespace('xsd', 'http://www.w3.org/2001/XMLSchema');
$test = (string) $xml->Body->SearchResponse->SearchResult->SearchURL;
var_export($test);
के माध्यम से भी आपके उत्तर के लिए धन्यवाद, xPath नेमस्पेस 500 त्रुटि देता है, शायद एक सर्वर गलत कॉन्फ़िगरेशन। दूसरा समाधान महान काम करता है। – Hamza