Jump to content

FIll1992

New Members
  • Posts

    3
  • Joined

  • Last visited

FIll1992's Achievements

Newbie

Newbie (1/5)

0

Reputation

1

Community Answers

  1. Thanks all for the Help! I have found the Solution: <?php $timestamp=time(); $uri = "https://api.cloud.kaufland.de/pdp-frontend/v1/316951680/offers?offset=0&limit=10&condition=used"; // Define all the mandatory headers $headers = [ 'Accept: application/json', 'Hm-Timestamp: ' . $timestamp, ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $uri); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $ch = json_decode(curl_exec($ch), true); foreach ($ch["usedOffers"] as $area) { $arrayname=$area["seller"]["name"]; $arrayprice=$area["price"]; echo '<br/>'; echo ''.$arrayname.' hat den Artikel für '.$arrayprice.' gelistet.'; } ?>
  2. Thanks for the great help so far. I would like to use PHP as the application runs in the background on the server. So far I have the following code: $timestamp=time(); $uri = "https://api.cloud.kaufland.de/pdp-frontend/v1/316951680/offers?offset=0&limit=10&condition=used"; // Define all the mandatory headers $headers = [ 'Accept: application/json', 'Hm-Timestamp: ' . $timestamp, ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $uri); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $ch = json_decode(curl_exec($ch), true); foreach ($ch as $key => $value) { echo $ch['usedOffers'][0]['id']; echo '<br/>'; } Issue, however, is: 386018798099 386018798099 386018798099 However, I deliberately accessed only the value "0" in the code. How do I now achieve that all values from "0", "1", "2" etc. are displayed? I do not always know the number of inner arrays?
  3. I have the following data, and would like to store the values "price", "status" and "name" in variables. However, I don't understand how to access the individual values. I have already tried it with loops (forearch), but without much success { "newOffers": null, "usedOffers": [ { "id": 386018798099, "price": 49.23, "deliveryRate": 0, "deliveryTime": "Mi. 26. - Do. 27. Juli", "deliveryTimeRange": { "min": "2023-07-26T00:00:01+02:00", "max": "2023-07-27T23:59:59+02:00" }, "fulfillmentType": "seller", "isHauler": false, "condition": { "status": "Gebraucht - Akzeptabel", "text": "Nintendo Switch Spiel Mario Kart 8 Deluxe nur Modul ohne OVP - nur Modul, gebraucht, getestet, funktionsfähig. Altersbedingte Gebrauchsspuren möglich. Meist Erstauflage. Download Codes i.d.R. bereits eingelöst. Sprache i.d.R. dt/engl. PAL Version. Mu" }, "seller": { "id": 654591, "name": "better-used", "isDirectSeller": false, "returnPeriod": "P1M", "freeReturnOptions": "advanced", "shopURL": "/shops/better-used" }, "priceThreshold": { "isAbove": true, "value": 40 } }, { "id": 386015598582, "price": 49.49, "deliveryRate": 0, "deliveryTime": "Mi. 26. - Do. 27. Juli", "deliveryTimeRange": { "min": "2023-07-26T00:00:01+02:00", "max": "2023-07-27T23:59:59+02:00" }, "fulfillmentType": "seller", "isHauler": false, "condition": { "status": "Gebraucht - Sehr gut", "text": "Sehr gut in OVP und Anleitung" }, "seller": { "id": 44296521, "name": "DorAdos", "isDirectSeller": false, "returnPeriod": "P14D", "freeReturnOptions": "default", "shopURL": "/shops/Dorados" }, "priceThreshold": { "isAbove": true, "value": 40 } }, { "id": 386289767027, "price": 55.56, "deliveryRate": 0, "deliveryTime": "Mi. 26. - Do. 27. Juli", "deliveryTimeRange": { "min": "2023-07-26T00:00:01+02:00", "max": "2023-07-27T23:59:59+02:00" }, "fulfillmentType": "seller", "isHauler": false, "condition": { "status": "Gebraucht - Wie neu", "text": "Nintendo Switch Spiel Mario Kart 8 Deluxe in OVP komplett in OVP - - Artikel lagernd, vom Fachhändler, Versand aus Deutschland. Weitere Spiele, Konsolen und Zubehör findest Du bei uns im Real Shop. Viel Spaß beim Zocken wünscht dir das better-used-T" }, "seller": { "id": 654591, "name": "better-used", "isDirectSeller": false, "returnPeriod": "P1M", "freeReturnOptions": "advanced", "shopURL": "/shops/better-used" }, "priceThreshold": { "isAbove": true, "value": 40 } } ], "fbk": { "offersToDeliveryGroups": null } } Can anyone help me here? (Source: https://api.cloud.kaufland.de/pdp-frontend/v1/316951680/offers?offset=0&limit=10&condition=used)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.