Forum Moderators: open

Message Too Old, No Replies

display external json data in div or table

         

nrik

3:40 pm on Dec 28, 2015 (gmt 0)

10+ Year Member Top Contributors Of The Month



Hi, first sorry for bad english... for my small hobby site, i need to import an external json data and display in div... but i don't know how :)

someone can help me?

json appear like this:

{        "dati": [

{
"id": 91309,
"tipo": "corsi",
"titolo": "La Pratica",
"sottotitolo": "",
"img": "",
"url": "#",
"data_da": "2015-12-24",
"data_a": "2015-12-24",
"stato": "IT",
"regione": "IT.08",
"provincia": "IT.08.GE",
"citta": "Genova",
"indirizzo": "Viale Brigata Bisagno 2/12"
},
{
"id": 93067,
"tipo": "corsi",
"titolo": "Settimana di Natale con German Ballejo e Magdalena Gutierrez!",
"sottotitolo": "",
"img": "#",
"url": "#",
"data_da": "2015-12-24",
"data_a": "2015-12-24",
"stato": "IT",
"regione": "IT.08",
"provincia": "IT.08.GE",
"citta": "Genova",
"indirizzo": "" } }

nrik

4:50 pm on Dec 29, 2015 (gmt 0)

10+ Year Member Top Contributors Of The Month



nothing?

oligalma

10:52 pm on Feb 14, 2016 (gmt 0)



You can use the PHP function file_get_contents() to load the file in a variable. Then you use json_decode() to store the JSON in an array. Finally, you print the array content in the div.