This it´s my json data - file :
> $fend='{
> "apollo": {
> "data": {
> "ProductItem:B009ZN8U96": {
> "id": "B009ZN8U96",
> "title": "Lenovo ThinkCentre Tiny Storage Unit Negro - Disco Duro en Red (Negro)",
> "brand": "Lenovo",
> "tags": {
> "type": "json",
> "json": ["Discos duros externos", "Almacenamiento de datos externo", "Almacenamiento de datos", "Informática"]
> },
> "related_items": {
> "type": "json",
> "json": ["B009ZN8U14", "B00Z08TZNU"]
> },
> "prices": [{
> "type": "id",
> "id": "ProductItem:B009ZN8U96.prices.0",
> "generated": true
> }, {
> "type": "id",
> "id": "ProductItem:B009ZN8U96.prices.1",
> "generated": true
> }, {
> "type": "id",
> "id": "ProductItem:B009ZN8U96.prices.2",
> "generated": true
> }, {
> "type": "id",
> "id": "ProductItem:B009ZN8U96.prices.3",
> "generated": true
> }, {
> "type": "id",
> "id": "ProductItem:B009ZN8U96.prices.4",
> "generated": true
> }],
> "images": {
> "type": "id",
> "id": "$ProductItem:B009ZN8U96.images",
> "generated": true
> },
> "chart": "https://charts.hagglezon.com/B009ZN8U96.png",
> "__typename": "ProductItem"
> },
> "ProductItem:B009ZN8U96.prices.0": {
> "country": "en",
> "price": "22.02",
> "currency": "EUR",
> "url": "https://www.amazon.co.uk/Lenovo-ThinkCentre-Tiny-Storage-Unit/dp/B009ZN8U96?SubscriptionId=AKIAJKVC5TM5C4Y6TOSQ&tag=haggle-web-en-21&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B009ZN8U96",
> "__typename": "Prices"
> },
> "ProductItem:B009ZN8U96.prices.1": {
> "country": "es",
> "price": "22.71",
> "currency": "EUR",
> "url": "https://www.amazon.es/Lenovo-ThinkCentre-Tiny-Storage-Negro/dp/B009ZN8U96?SubscriptionId=AKIAJKVC5TM5C4Y6TOSQ&tag=haggle-web-es-21&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B009ZN8U96",
> "__typename": "Prices"
> },
> "ProductItem:B009ZN8U96.prices.2": {
> "country": "it",
> "price": "23.18",
> "currency": "EUR",
> "url": "https://www.amazon.it/Lenovo-ThinkCentre-Tiny-Storage-Unit/dp/B009ZN8U96?SubscriptionId=AKIAIJYBMV6KUA55XTDA&tag=haggle-web-it-21&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B009ZN8U96",
> "__typename": "Prices"
> },
> "ProductItem:B009ZN8U96.prices.3": {
> "country": "fr",
> "price": "27.25",
> "currency": "EUR",
> "url": "https://www.amazon.fr/Lenovo-PCW-0B47375-0B47375-Noir/dp/B009ZN8U96?SubscriptionId=AKIAJGIY7FE2CHC4YNTA&tag=haggle-web-fr-21&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B009ZN8U96",
> "__typename": "Prices"
> },
> "ProductItem:B009ZN8U96.prices.4": {
> "country": "de",
> "price": "33.32",
> "currency": "EUR",
> "url": "https://www.amazon.de/Lenovo-ThinkCentre-Tiny-Storage-Unit/dp/B009ZN8U96?SubscriptionId=AKIAJGIY7FE2CHC4YNTA&tag=haggle-web-de-21&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B009ZN8U96",
> "__typename": "Prices"
> },
> "$ProductItem:B009ZN8U96.images": {
> "small": "https://images-eu.ssl-images-amazon.com/images/I/31tLd6DMO-L._SL75_.jpg",
> "medium": "https://images-eu.ssl-images-amazon.com/images/I/31tLd6DMO-L._SL160_.jpg",
> "large": "https://images-eu.ssl-images-amazon.com/images/I/31tLd6DMO-L.jpg",
> "__typename": "Images"
> },
> "$ROOT_QUERY.searchResults({\"search\":\"B009ZN8U96\",\"lang\":\"es\"})":
> {
> "products": [{
> "type": "id",
> "id": "ProductItem:B009ZN8U96",
> "generated": false
> }],
> "hasMore": false,
> "nextPage": null,
> "status": "200",
> "error": null,
> "__typename": "SearchResults"
> },
> "ROOT_QUERY": {
> "searchResults({\"search\":\"B009ZN8U96\",\"lang\":\"es\"})": {
> "type": "id",
> "id": "$ROOT_QUERY.searchResults({\"search\":\"B009ZN8U96\",\"lang\":\"es\"})",
> "generated": true
> }
> }
> },
> "optimistic": [],
> "reducerError": null
> },
> "favs": [],
> "i18n": {
> "lang": "en-gb",
> "locale": "en"
> },
> "searchLang": "",
> "seenFeatures": [],
> "chart": {},
> "searchContext": {
> "title": "Lenovo ThinkCentre Tiny Storage Unit Negro - Disco Duro en Red (Negro)",
> "tags": ["Discos duros externos", "Almacenamiento de datos externo", "Almacenamiento de datos", "Informática"],
> "related": ["B009ZN8U14", "B00Z08TZNU"],
> "nextPage": null,
> "hasMore": false,
> "query": "B009ZN8U96",
> "isSingle": true,
> "brand": "Lenovo"
> }
> }';
And i try show informations from kson code using this code bu i can´t get works
$rr=json_decode($fend); foreach($rr->apollo as $result) { $lines=$result->data; foreach ($lines as $line) { echo $line->ProductItem; foreach ($line->ProductItem as $word) { echo($word->id . "\n"); } } }
I need extract data from json file and show informations from Uk for example, "en" and extract price but i think it´s all ok, but sure some question it´s bad, because i can´t get, the prblem
I try many combinations and don´t get any result, if you can tell me what´s wrong perfect, thank´s !!!!!