How to compress JSON from PHP and decompress in ASP.NET
I am having a problem passing JSON from PHP server and ASP.NET server. I am getting Fatal error: Allowed memory size of 67108864 bytes exha开发者_运维问答usted (tried to allocate 48 bytes)
I am looking for a way to compress the JSON.
Thanks
Compressing the JSON will probably not change anything, since you'll need the uncompressed JSON before you can compress it (ie. you'll end up using even more memory then you are using currently).
Flush the output buffers regularly, so you don't need to have more than a few KB to produce your many MB stream.
Why not increase your memory size in your PHP.ini file?
.NET has built in compression classes. Such as the DeflateStream or GzipStream classes located in the System.IO.Compression namespace. They should do the trick.
精彩评论