|
...
|
...
|
@@ -39,18 +39,18 @@ class HttpUtils |
|
|
|
* @return int
|
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException
|
|
|
|
*/
|
|
|
|
public static function get($url, $data, $headers = [])
|
|
|
|
public static function get($url, $data, $headers = [],$timeout=60)
|
|
|
|
{
|
|
|
|
LogUtils::info("HttpUtils-GET请求URL:" . $url);
|
|
|
|
$response = Http::timeout(60)->withHeaders($headers)->get($url, $data);
|
|
|
|
$response = Http::timeout($timeout)->withHeaders($headers)->get($url, $data);
|
|
|
|
self::checkSuccess($response);
|
|
|
|
return $response->getBody()->getContents();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function post($url, $data, $headers = [])
|
|
|
|
public static function post($url, $data, $headers = [],$timeout=60)
|
|
|
|
{
|
|
|
|
LogUtils::info("HttpUtils-POST请求URL:" . $url);
|
|
|
|
$response = Http::timeout(60)->withHeaders($headers)->post($url, $data);
|
|
|
|
$response = Http::timeout($timeout)->withHeaders($headers)->post($url, $data);
|
|
|
|
self::checkSuccess($response);
|
|
|
|
return $response->getBody()->getContents();
|
|
|
|
}
|
...
|
...
|
|