Bonjour à tous,

J'ai un soucis pour récupérer un simple noeud.

Voici le xml:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
 
<query yahoo:count="1" yahoo:created="2016-06-20T09:29:00Z" yahoo:lang="fr"><results><place xml:lang="en-US" yahoo:uri="http://where.yahooapis.com/v1/place/580778"><woeid>580778</woeid><placeTypeName code="7">Town</placeTypeName><name>Bordeaux</name><country code="FR" type="Country" woeid="23424819">France</country><admin1 code="" type="Region" woeid="7153309">Aquitaine</admin1><admin2 code="" type="Department" woeid="12597132">Gironde</admin2><admin3/><locality1 type="Town" woeid="580778">Bordeaux</locality1><locality2/><postal/><centroid></centroid><boundingBox></boundingBox><areaRank>1</areaRank><popRank>1</popRank><timezone type="Time Zone" woeid="28350911">Europe/Paris</timezone></place></results></query><!-- total: 10 -->
<!-- main-2322b281-1df8-11e6-a4df-d4ae52974c31 -->
Si je fais:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
 
$weather_xml = simplexml_load_string($weather_string);
$woeid = $weather_xml->xpath('results');
var_dump($woeid);
Je récupère
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
 
 
array(1) {
  [0]=>
  object(SimpleXMLElement)#10 (1) {
    ["place"]=>
    object(SimpleXMLElement)#11 (15) {
      ["woeid"]=>
      string(6) "580778"
      ["placeTypeName"]=>
      string(4) "Town"
      ["name"]=>
      string(8) "Bordeaux"
      ["country"]=>
      string(6) "France"
      ["admin1"]=>
      string(9) "Aquitaine"
      ["admin2"]=>
      string(7) "Gironde"
      ["admin3"]=>
      object(SimpleXMLElement)#12 (0) {
      }
      ["locality1"]=>
      string(8) "Bordeaux"
      ["locality2"]=>
      object(SimpleXMLElement)#13 (0) {
      }
      ["postal"]=>
      object(SimpleXMLElement)#14 (0) {
      }
      ["centroid"]=>
      object(SimpleXMLElement)#15 (2) {
        ["latitude"]=>
        string(8) "44.84948"
        ["longitude"]=>
        string(8) "-0.57653"
      }
      ["boundingBox"]=>
      object(SimpleXMLElement)#16 (2) {
        ["southWest"]=>
        object(SimpleXMLElement)#17 (2) {
          ["latitude"]=>
          string(9) "44.810928"
          ["longitude"]=>
          string(8) "-0.63874"
        }
        ["northEast"]=>
        object(SimpleXMLElement)#18 (2) {
          ["latitude"]=>
          string(9) "44.898319"
          ["longitude"]=>
          string(8) "-0.53333"
        }
      }
      ["areaRank"]=>
      string(1) "1"
      ["popRank"]=>
      string(1) "1"
      ["timezone"]=>
      string(12) "Europe/Paris"
    }
  }
}
Je souhaite récupérer la valeur de woeid donc je fais
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
$weather_xml = simplexml_load_string($weather_string);
$woeid = $weather_xml->xpath('results/place/woeid');
var_dump($woeid);
Et la je récupère:
Comment faire pour récupérer 580778 ?

Merci de votre aide