I’m trying to get json response from stackoverflow api with file_get_contents(), but comes back to me strange chars like I–%&/mÊ{JõJ×àt¡€$Ø@ìÁˆÍæ’ìiG#)«*ÊeVe]f@ etc etc…
Ok, the address is http://api.stackoverflow.com/1.1/users/779187/
My code is
$json_res = json_decode(file_get_contents("http://api.stackoverflow.com/1.1/users/779187/"))
obvious the response of json_dec is NULL because the string is not json.
I also tried directly dump value without json_decode, the result is “I–%&/mÊ{JõJ×àt¡€`$…”
thanks for help
Use
gzdecodeto decode compressed content. You should use implementation from this page if you don’t have gzdecode function. I have checked that it works with the page you want to retrieve.