Bonsoir,
J'ai besoin de parser un flux xml (qui provient d'availpro) pour l'intégrer dans un CMS (spip), ce flux me donne des infos description et images sur des hôtels...

voila a quoi ressemble mon flux :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
 
 
<?xml version="1.0" encoding="utf-8" ?>
<OTA_HotelDescriptiveInfoRS Target="Production" Version="1" SequenceNmbr="1"
PrimaryLangID="EN" AltLangID="EN"
xmlns="http://www.opentravel.org/OTA/2003/05"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opentravel.org/OTA/2003/05
OTA_HotelDescriptiveInfoRS.xsd">
 
<HotelDescriptiveContents ChainCode="311" HotelCode="1001"
HotelCityCode="Paris" HotelName="Hotel de la Sorbonne"
HotelCodeContext="crs">
 
<HotelDescriptiveContent LanguageCode="EN">
<HotelInfo>
<HotelName>Hotel de la Sorbonne</HotelName>
<Descriptions>
<Description Name="Description" Language="EN">
<Text Language="EN">Opposite the Sorbonne, one
minute from the Luxembourg Gardens and the
Pantheon, this lovely hotel (renovated in 2002) will
envelop you in its warmth and colour. </Text>
<URL>www.hotelsorbonne.com</URL>
</Description>
HowToGetThere : Comment se rendre à lhôtel.
<Description Name="HowToGetThere" Language="EN">
<Text Language="EN">Métro : Cluny-La Sorbonne
(ligne 10) RER B et C : Saint Michel</Text>
</Description>
 
<Description Name="PriceFrom">
<Text>40.00 EUR</Text>
</Description>
<Description Name="logo">
<Image>http://83.169.66.55/img/propertydescription_lo
go_1001_311.jpg</Image>
</Description>
<Description Name="photo1">
<Image>http://83.169.66.55/img/propertydescription_p
hoto1_1001_311.jpg</Image>
</Description>
<Description Name="photo2">
<Image>http://83.169.66.55/img/propertydescription_p
hoto2_1001_311.jpg</Image>
</Description>
<Description Name="photo3">
<Image>http://83.169.66.55/img/propertydescription_p
hoto3_1001_311.jpg</Image>
</Description>
<Description Name="photo4">
<Image>http://83.169.66.55/img/propertydescription_p
hoto4_1001_311.jpg</Image>
</Description>
<Description Name="photo5">
<Image>http://83.169.66.55/img/propertydescription_p
hoto5_1001_311.jpg</Image>
</Description>
</Descriptions>
 
<Services>
<Service>
<Description Name="24x24 hrs reception"
Language="EN" />
</Service>
<Service>
<Description Name="Central heating" Language="EN"
/>
</Service>
<Service>
<Description Name="Lift" Language="EN" />
</Service>
<Service>
<Description Name="Luggage storage" Language="EN"
/>
</Service>
<Service>
<Description Name="Excursions and tours"
Language="EN" />
</Service>
</Services>
</HotelInfo>
<Policies>
/12
<Policy>
<GuaranteePaymentPolicy>
<GuaranteePayment>
 
<AcceptedPayments>
<AcceptedPayment>
<PaymentCard CardCode="VI" />
</AcceptedPayment>
<AcceptedPayment>
<PaymentCard CardCode="MC" />
</AcceptedPayment>
<AcceptedPayment>
<PaymentCard CardCode="AX" />
</AcceptedPayment>
<AcceptedPayment>
<PaymentCard CardCode="DN" />
</AcceptedPayment>
<AcceptedPayment>
<PaymentCard CardCode="JC" />
</AcceptedPayment>
</AcceptedPayments>
</GuaranteePayment>
</GuaranteePaymentPolicy>
</Policy>
</Policies>
<AffiliationInfo>
<Awards>
 
<Award Rating="**" />
</Awards>
</AffiliationInfo>
 
<ContactInfos>
<ContactInfo>
<Addresses>
<Address>
<AddressLine>6 rue Victor Cousin</AddressLine>
<CityName>Paris</CityName>
<PostalCode>75005</PostalCode>
<StateProv />
<CountryName>France</CountryName>
</Address>
</Addresses>
<Phones>
 
<Phone PhoneTechType="1" PhoneNumber="(+33) 1
43545808" />
 
<Phone PhoneTechType="3" PhoneNumber="(+33) 1
40510518" />
</Phones>
</ContactInfo>
</ContactInfos>
</HotelDescriptiveContent>
</HotelDescriptiveContents>
</OTA_HotelDescriptiveInfoRS>


j'ai essayer d'utiliser la fonction simplexml mais je n'arrive pas a tout recuperer


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 
<?php
 
$flux = simplexml_load_file($url);
 
 
foreach ($flux->HotelDescriptiveContents  as $item) {
 
 
$HotelCode		=	$item->attributes() -> HotelCode;
$HotelCityCode	=	$item->attributes() -> HotelCityCode;
$HotelName2		=	$item->attributes() -> HotelName;
$HotelName 		= 	$item->HotelDescriptiveContent->HotelInfo->HotelName;
$Starsnumber		= 	$item->HotelDescriptiveContent->AffiliationInfo->Awards->Award->attributes() -> {"Rating"} ;
$AddressLine		= 	$item->HotelDescriptiveContent->ContactInfos->ContactInfo->Addresses->Address->AddressLine ;
$CityName			= 	$item->HotelDescriptiveContent->ContactInfos->ContactInfo->Addresses->Address->CityName ;
$PostalCode			= 	$item->HotelDescriptiveContent->ContactInfos->ContactInfo->Addresses->Address->PostalCode ;
$StateProv			= 	$item->HotelDescriptiveContent->ContactInfos->ContactInfo->Addresses->Address->StateProv ;
$CountryName		= 	$item->HotelDescriptiveContent->ContactInfos->ContactInfo->Addresses->Address->CountryName ;
$telephone			= 	$item->HotelDescriptiveContent->ContactInfos->ContactInfo->Phones->Phone[0]->attributes() -> PhoneNumber;
$fax				= 	$item->HotelDescriptiveContent->ContactInfos->ContactInfo->Phones->Phone[1]->attributes() -> PhoneNumber;
$Description 				= 	$item->HotelDescriptiveContent->HotelInfo->Descriptions->Description->Text ;
}
 
?>
En faite, je n'arrive pas a récupérer tout ce qui est dans la partie descriptions ,les texte et images

je recupere le premier texte (description) mais apres pour les autres il faut
je fasse avec des [0] sur description pour chaque ? il y a pas un moyen d'identfié clairement photo logo price etc... ?
descrption name=photo ?

est ce que vous pourriez m'aider avec mon ptit problème ?
merci