开发者

differ json from gzipp

开发者 https://www.devze.com 2023-02-05 01:42 出处:网络
I have a follow implementation problem. I am working with some api and I must upload image file and get result in gzipped format or a JSON error message.

I have a follow implementation problem.

I am working with some api and I must upload image file and get result in gzipped format or a JSON error message. How can I differ json and gzipped files with php开发者_如何学Go (I think they are resource type). I have one idea:

call json function to result and if error occured call php die function .

But I don't think it's a best solution.

Thank's


With the Content-Type HTTP response header (but if the API is any good, then if there is an error that will be reflected in the HTTP status code, so you should look there first).

0

精彩评论

暂无评论...
验证码 换一张
取 消