用 Guzzlehttp 发送 gzip 压缩过的 json 数据,post 请求
1 2 3 4 5 6 7 8 9 |
// Provide the body as a string. $response = $http->request('POST', $api . '?' . $build_query_data, [ 'headers' => ['Content-Encoding' => 'gzip'], 'body' => gzencode(json_encode($query)) ]); $result = json_decode($response->getBody(), true); $statusCode = $response->getStatusCode(); |
近期评论