I have a small PHP script that is supposed to get all the values from a web service´s JSON. But after decoding it, I keep getting error 4.
$url_de = "http://ws-old.parlament.ch/factions?format=json&lang=de&pretty=true";
$jsonObject = json_decode(file_get_contents($url_de));
The string $url_de has the URL of website´s JSON file that contains the following when viewed in a browser:
[
{
"name": "Liberale Fraktion",
"shortName": "Fraktion L",
"code": "FRA_7_",
"abbreviation": "L",
"id": 7,
"updated": "2015-08-31T08:53:40Z"
},
{
"name": "Sozialdemokratische Fraktion",
"shortName": "Fraktion S",
"code": "FRA_2_",
"abbreviation": "S",
"id": 2,
"updated": "2015-08-24T15:28:11Z",
"hasMorePages": false
}
]
When using var_dump I keep getting NULL. Any ideas how to fix it? I would like to output certain keys and their values.
EDIT: This is the HTML output when using var_dump enter image description here Thanks for the help in advance.