Z
Z
Zimaell2020-09-23 10:17:41
PHP
Zimaell, 2020-09-23 10:17:41

How to zip POST in php and unpack in C#?

The data before sending looks something like this

array(2) {
  [5]=>
  array(9) {
    ["2020-09-23 07:04:41.649000"]=>string(11) "T,1"
    ["2020-09-23 07:04:41.652000"]=>string(13) "D,10"
...............................
  }
  [1]=>
  array(99) {
    ["2020-09-23 07:04:29.903000"]=>string(13) "M,0,0"
    ["2020-09-23 07:04:30.153000"]=>string(13) "M,1,0"
...............................

Are there any functions that compress the whole thing before sending it to save traffic?
And I want to note one nuance - the PHP server part sends, the client C # receives ...
Therefore, the functions for compressing in PHP and decompressing in C #, tell me what can be used?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Adamos, 2020-09-23
@Adamos

In fact, any web server can do transparent data compression.
Unless, of course, the client sends a request with the appropriate Accept-encoding and is ready to parse the compressed response.

I
Ilya, 2020-09-23
@rpsv

Create an archive with a json (for example) file inside with data, send the file to the client.
An example of working with zip: https://www.php.net/manual/ru/zip.examples.php
-
Or you can compress just a string: https://www.php.net/manual/ru/function.gzencode.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question