Beste,
Momenteel ben ik bezig om een script in elkaar te zetten om een json file (+/- 4000 regels en 15000 tekens) om te zetten naar de database.
Helaas krijg ik maar een beperkt aantal gegevens terug en krijg ik via internet niet voldoende duidelijkheid hoe ik dit kan oplossen.
Json code (Stukje ervan)
PHP code (Debug/controle script)
Output
Volgens mij zie ik in het php deel iets over het hoofd maar ik weet niet wat omdat ik nog weinig ervaring heb met json omzetten.
Momenteel ben ik bezig om een script in elkaar te zetten om een json file (+/- 4000 regels en 15000 tekens) om te zetten naar de database.
Helaas krijg ik maar een beperkt aantal gegevens terug en krijg ik via internet niet voldoende duidelijkheid hoe ik dit kan oplossen.
Json code (Stukje ervan)
{
"base-info": {
"identifier": "ultimatecore",
"name": "UltimateCore",
"version": "3.0.8-SNAPSHOT"
},
"modules": [
{
"identifier": "kick",
"description": "Allows you to kick a player from the server.",
"enabledbydefault": true,
"hasconfig": false
},
{
"identifier": "burn",
"description": "Set a player on fire using the /burn command.",
"enabledbydefault": true,
"hasconfig": false
}
],
"commands": [
{
"identifier": "kick",
"description": "Kick a player from the server.",
"aliases": [
"kick"
],
"module": "kick",
"basepermissions": "uc.kick.kick.base",
"permissions": [
"uc.kick.kick.base"
],
"usage": "/kick <Player> [Reason]"
},
{
"identifier": "kickall",
"description": "Kick all players from the server.",
"aliases": [
"kickall",
"kickeveryone"
],
"module": "kick",
"basepermissions": "uc.kick.kickall.base",
"permissions": [
"uc.kick.kickall.base"
],
"usage": "/kickall [Reason]"
},
{
"identifier": "burn",
"description": "Set people on fire.",
"aliases": [
"burn",
"fire",
"ignite"
],
"module": "burn",
"basepermissions": "uc.burn.burn.base",
"permissions": [
"uc.burn.burn.base"
],
"usage": "/burn <Player> [Time]"
}
]
} PHP code (Debug/controle script)
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$jsondata[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/file_get_contents"]file_get_contents[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]http://pastebin.com/raw/96qJtGNS[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$data[/COLOR] [COLOR= #007700]=[/COLOR] json_decode[COLOR= #007700]([/COLOR][COLOR= #0000BB]$jsondata[/COLOR][COLOR= #007700],[/COLOR] true[COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br><br><br>Base-info: indentifier <strong>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$datarow1[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$data[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]base-info[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]identifier[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</strong><br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Base-info: name <strong>[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$datarow2[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$data[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]base-info[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</strong><br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Base-info: version <strong>[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$datarow3[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$data[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]base-info[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]version[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</strong><br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Modules: indentifier <strong>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$datarow4[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$data[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]modules[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]identifier[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</strong><br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Modules: desc <strong>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$datarow5[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$data[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]modules[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]description[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</strong><br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Modules: enabled default <strong>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$datarow6[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$data[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]modules[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]enabledbydefault[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</strong><br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Modules: config <strong>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$datarow7[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$data[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]modules[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]hasconfig[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</strong><br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Commands: indentifier <strong>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$datarow8[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$data[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]commands[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]identifier[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]postalcode[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</strong><br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Commands: desc <strong>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$datarow9[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$data[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]commands[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]description[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</strong><br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Commands: alias <strong>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$datarow10[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$data[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]commands[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]aliases[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</strong><br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Commands: module <strong>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$datarow11[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$data[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]commands[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]module[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</strong><br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Commands: baseperm <strong>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$datarow12[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$data[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]commands[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]basepermissions[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</strong><br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Commands: perms <strong>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$datarow13[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$data[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]commands[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]permissions[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</strong><br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Commands: usage <strong>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$datarow14[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$data[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]commands[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]usage[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</strong><br>[/COLOR][COLOR= #007700];[/COLOR]
?> Output
Base-info: indentifier ultimatecore
Base-info: name UltimateCore
Base-info: version 3.0.8-SNAPSHOT
Modules: indentifier
Modules: desc
Modules: enabled default
Modules: config
Commands: indentifier
Commands: desc
Commands: alias
Commands: module
Commands: baseperm
Commands: perms
Commands: usage Volgens mij zie ik in het php deel iets over het hoofd maar ik weet niet wat omdat ik nog weinig ervaring heb met json omzetten.