/** * @param $url * @param array $params * @param $gzip * @return mixed|null * @throws RequestException */ public static function httpPostJson($url, $params = [], $gzip = false) { if (!array_key_exists('version', $params)) { $params['version'] = GTConfig::getSDKVersion(); } $action = $params['action']; $data = json_encode($params); $result = null; try { $resp = HttpManager::httpPost($url, $data, $gzip, $action); LogUtils::debug('发送请求 post:{$data} return:{$resp}'); $result = json_decode($resp, true); return $result; } catch (\Exception $e) { throw new RequestException($params['requestId'], 'httpPost:[' . $url . '] [' . $data . ' ] [ ' . $result . ']:', $e); } }
public static function httpPostJson($url, $params, $gzip) { if (is_null($params["version"])) { $params["version"] = GTConfig::getSDKVersion(); } $action = $params["action"]; $data = json_encode($params); $result = null; try { $resp = HttpManager::httpPost($url, $data, $gzip, $action); LogUtils::debug("发送请求 post:{$data} return:{$resp}"); $result = json_decode($resp, true); return $result; } catch (Exception $e) { throw new RequestException($params["requestId"], "httpPost:[" . $url . "] [" . $data . " ] [ " . $result . "]:", $e); } }