I have been having trouble getting a result from this wondered if someone may be able to help me.
I am trying to decode/parse this json output from a URL so that I can extract "result" and "success" and place them into variables. So far I cant even parse the json output and when I try to print $data just returns "unexpected T_VARIABLE".
JSON output:
[{"result":"success","success":"1.7.2","source":"version","tag":"sampleTag","is_success":true}]
My code:
$json = file_get_contents($url);
$data = json_decode($json, TRUE);
print_r $data;
Ive done some limited work with json before, and I have never seen an output in square brackets [ ] like this...
Could this be where im going wrong? Any suggestions appricated.
Thanks.