I just noticed an odd result with my code:
$data = @file_get_contents($url); //gets json format from API
return $data;
It returns a random character in front of the first {
and after the last }
.
Because of this, I cant use json_decode()
because the json is now invalid because of the extra characters.
I have checked the actual api url and it doesn't have those random characters.
Why could this be happening?
Note: Sometimes it even returns a black diamond with a white question mark.
I'm reading API's from Steam Community.
I improvised with a temporary fix while im trying to find the code causing the problem.
$data = substr($data, 1, -1);