Bonsoir tout le monde,

Je suis en stage de première année de BTS, sans tuteur et seule développeuse de la boite. Donc je suis seule avec mes question, d'où ma présence ici !
On me demande de faire de développer une page web permettant d'extraire des statistiques d'une recherche eBay. J'ai aussitôt pensé à utiliser une de leurs API, mais voilà, comme je suis débutante, je n'arrive pas à extraire les données que je veux de ma requête.

J'ai suivi la doc d'eBay pour faire ce code là :

Code html : 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
<?php 
 
$product = $_POST['product'];
?>
 
<html>
 
	<head>
		<title>eBay Search Results</title>
		<style type="text/css">body { font-family: arial,sans-serif;} </style>
	</head>
 
	<body>
 
		<h1>eBay Search Results</h1>
 
		<div id="results"></div>
 
 
		<script>
 
                        // Parse the response and build an HTML table to display search results
                        function _cb_findItemsByKeywords(root) {
                          var items = root.findItemsByKeywordsResponse[0].searchResult[0].item || [];
                          var html = [];
                          html.push('<table width="100%" border="0" cellspacing="0" cellpadding="3"><tbody>');
                          for (var i = 0; i < items.length; ++i) {
                            var item     = items[i];
                            var title    = item.title;
                            var pic      = item.galleryURL;
                            var viewitem = item.viewItemURL;
                            var price    = item.sellingStatus;
                            
                            if (null != title && null != viewitem) {
                              html.push('<tr><td>' + '<img src="' + pic + '" border="0">' + '</td>' + 
                              '<td><a href="' + viewitem + '" target="_blank">' + title + '</a></td><td>'+price+'</td></tr>');
                            }
                          }
                          html.push('</tbody></table>');
                          document.getElementById("results").innerHTML = html.join("");
                        }  // End _cb_findItemsByKeywords() function
 
                        // Create a JavaScript array of the item filters you want to use in your request
                        var filterarray = [
                          {"name":"MaxPrice", 
                           "value":"25", 
                           "paramName":"Currency", 
                           "paramValue":"USD"},
                          {"name":"FreeShippingOnly", 
                           "value":"true", 
                           "paramName":"", 
                           "paramValue":""},
                          {"name":"ListingType", 
                           "value":["AuctionWithBIN", "FixedPrice", "StoreInventory"], 
                           "paramName":"", 
                           "paramValue":""},
                          ];
 
 
                        // Define global variable for the URL filter
                        var urlfilter = "";
 
                        // Generates an indexed URL snippet from the array of item filters
                        function  buildURLArray() {
                          // Iterate through each filter in the array
                          for(var i=0; i<filterarray.length; i++) {
                            //Index each item filter in filterarray
                            var itemfilter = filterarray[i];
                            // Iterate through each parameter in each item filter
                            for(var index in itemfilter) {
                              // Check to see if the paramter has a value (some don't)
                              if (itemfilter[index] !== "") {
                                if (itemfilter[index] instanceof Array) {
                                  for(var r=0; r<itemfilter[index].length; r++) {
                                  var value = itemfilter[index][r];
                                  urlfilter += "&itemFilter\(" + i + "\)." + index + "\(" + r + "\)=" + value ;
                                  }
                                } 
                                else {
                                  urlfilter += "&itemFilter\(" + i + "\)." + index + "=" + itemfilter[index];
                                }
                              }
                            }
                          }
                        }  // End buildURLArray() function
 
                        // Execute the function to build the URL filter
                        buildURLArray(filterarray);
 
                        var product = <?php echo json_encode($product); ?>;
 
                        // Construct the request
                        // Replace MyAppID with your Production AppID
                        var url = "http://svcs.ebay.com/services/search/FindingService/v1";
                            url += "?OPERATION-NAME=findItemsByKeywords";
                            url += "&SERVICE-VERSION=1.0.0";
                            url += "&SECURITY-APPNAME=*****************";
                            url += "&GLOBAL-ID=EBAY-US";
                            url += "&RESPONSE-DATA-FORMAT=JSON";
                            url += "&callback=_cb_findItemsByKeywords";
                            url += "&REST-PAYLOAD";
                            url += "&keywords="+encodeURI(product);;
                            url += "&paginationInput.entriesPerPage=3";
                            url += urlfilter;
 
 
                        // Submit the request 
                        s=document.createElement('script'); // create script element
                        s.src= url;
                        document.body.appendChild(s);
 
                        // Display the request as a clickable link for testing
                        document.write("<a href=\"" + url + "\">" + url + "</a>");
   
                </script>
 
	</body>
 
</html>

et là réponse que j'en tire commence comme ça :

Nom : Sans titre.png
Affichages : 152
Taille : 41,3 Ko

C'est la ligne surligné qui m'intéresse. Je n'arrive à définir ma variable pour extraire le prix de l'item.
J'ai essayé plusieurs chose :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
var price = item.sellingStatus; // //Retourne [object Object]
var price = item.currentPrice; //Retourne "undefined"
var price = item.__value__; //Retourne "undefined"
et d'autres mais à chaque fois ma variable n'est pas défini ou bien j'ai une erreur javascript ou bien cela m'affiche [object Object].

Pouvez vous m'aider svp ?

Merci d'avance et bonne soirée