json_decode doesn’t decode in-place (it doesn’t automatically rewrite the variable you pass in). You need to do $getcontents = json_decode($getcontents);
json_decode doesn’t decode in-place (it doesn’t automatically rewrite the variable you pass in). You need to do $getcontents = json_decode($getcontents);