= 462850) { curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, 30000); curl_setopt($curl, CURLOPT_NOSIGNAL, 1); } //通过代理访问接口需要在此处配置代理 //curl_setopt($curl, CURLOPT_PROXY, '192.168.1.18:808'); //请求失败有3次重试机会 $result = HttpManager::exeBySetTimes(3, $curl); curl_close($curl); return $result; } public static function httpPostJson($url, $params, $gzip) { if(!isset($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); } } private static function exeBySetTimes($count, $curl) { $result = curl_exec($curl); if (curl_errno($curl)) { LogUtils::debug("请求错误: " . curl_errno($curl)); if ($count > 0) { $count--; $result = HttpManager::exeBySetTimes($count, $curl); } } return $result; } }