From 5add791ef1e573acd0aedab9826a8d07fc62cd6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Mon, 9 Jun 2025 05:04:06 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E4=BD=BF=E7=94=A8guzzlehttp?= =?UTF-8?q?=E5=8F=91=E9=80=81=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common.php | 263 ++++++++------ app/lib/client/Ucloud.php | 2 +- app/lib/deploy/baishan.php | 2 +- app/lib/deploy/btwaf.php | 6 +- app/lib/deploy/cachefly.php | 4 +- app/lib/deploy/cdnfly.php | 4 +- app/lib/deploy/doge.php | 6 +- app/lib/deploy/gcore.php | 4 +- app/lib/deploy/goedge.php | 8 +- app/lib/deploy/kangle.php | 8 +- app/lib/deploy/kangleadmin.php | 4 +- app/lib/deploy/kuocai.php | 2 +- app/lib/deploy/lecdn.php | 6 +- app/lib/deploy/mwpanel.php | 4 +- app/lib/deploy/opanel.php | 8 +- app/lib/deploy/proxmox.php | 9 +- app/lib/deploy/ratpanel.php | 8 +- app/lib/deploy/safeline.php | 6 +- app/lib/deploy/upyun.php | 4 +- app/lib/deploy/wangsu.php | 26 +- app/lib/dns/powerdns.php | 5 +- app/service/OptimizeService.php | 2 +- app/utils/CheckUtils.php | 98 +++-- app/utils/DnsQueryUtils.php | 2 +- app/utils/MsgNotice.php | 10 +- composer.json | 21 +- composer.lock | 624 ++++++++++++++++++++++++++++---- 27 files changed, 822 insertions(+), 324 deletions(-) diff --git a/app/common.php b/app/common.php index 2719cd1..0f3bcc3 100644 --- a/app/common.php +++ b/app/common.php @@ -1,50 +1,52 @@ 10, + 'verify' => false, + 'headers' => [ + 'Content-Type' => 'application/x-www-form-urlencoded', + 'User-Agent' => $ua ?: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36' + ], + 'http_errors' => false // 不抛出异常 + ]; + + $options['headers'] = array_merge($options['headers'], $addheader); + if ($referer) { + $options['headers']['Referer'] = $referer; } if ($cookie) { - curl_setopt($ch, CURLOPT_COOKIE, $cookie); + $options['headers']['Cookie'] = $cookie; } - if ($referer) { - curl_setopt($ch, CURLOPT_REFERER, $referer); + + $method = 'GET'; + if ($post) { + $method = 'POST'; + if (is_array($post)) { + $options['form_params'] = $post; + } else { + $options['body'] = $post; + } } - if ($ua) { - curl_setopt($ch, CURLOPT_USERAGENT, $ua); - } else { - curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Linux; U; Android 4.0.4; es-mx; HTC_One_X Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0"); + + try { + $client = new Client(); + $response = $client->request($method, $url, $options); + + if ($nobody) { + return ''; + } + + return $response->getBody()->getContents(); + } catch (GuzzleException $e) { + return ''; } - if ($nobody) { - curl_setopt($ch, CURLOPT_NOBODY, 1); - } - curl_setopt($ch, CURLOPT_ENCODING, "gzip"); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - $ret = curl_exec($ch); - curl_close($ch); - return $ret; } function real_ip($type = 0) @@ -319,47 +321,41 @@ function getMainDomain($host) function check_proxy($url, $proxy_server, $proxy_port, $type, $proxy_user, $proxy_pwd) { - $ch = curl_init($url); - if ($type == 'https') { - $proxy_type = CURLPROXY_HTTPS; - } elseif ($type == 'sock4') { - $proxy_type = CURLPROXY_SOCKS4; - } elseif ($type == 'sock5') { - $proxy_type = CURLPROXY_SOCKS5; - } elseif ($type == 'sock5h') { - $proxy_type = CURLPROXY_SOCKS5_HOSTNAME; - } else { - $proxy_type = CURLPROXY_HTTP; - } - curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_BASIC); - curl_setopt($ch, CURLOPT_PROXY, $proxy_server); - curl_setopt($ch, CURLOPT_PROXYPORT, intval($proxy_port)); + match ($type) { + 'https' => $proxy_string = 'https://', + 'sock4' => $proxy_string = 'socks4://', + 'sock5' => $proxy_string = 'socks5://', + 'sock5h' => $proxy_string = 'socks5h://', + default => $proxy_string = 'http://', + }; + if (!empty($proxy_user) && !empty($proxy_pwd)) { - curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxy_user . ':' . $proxy_pwd); + $proxy_string .= $proxy_user . ':' . $proxy_pwd . '@'; } - curl_setopt($ch, CURLOPT_PROXYTYPE, $proxy_type); - $httpheader[] = "Accept: */*"; - $httpheader[] = "Accept-Language: zh-CN,zh;q=0.8"; - $httpheader[] = "Connection: close"; - curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36'); - curl_setopt($ch, CURLOPT_TIMEOUT, 3); - curl_exec($ch); - $errno = curl_errno($ch); - if ($errno) { - $errmsg = curl_error($ch); - curl_close($ch); - throw new Exception($errmsg); - } - $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); - curl_close($ch); - if ($httpCode >= 200 && $httpCode < 400) { - return true; - } else { - throw new Exception('HTTP状态码异常:' . $httpCode); + + $proxy_string .= $proxy_server . ':' . intval($proxy_port); + $options = [ + 'proxy' => $proxy_string, + 'timeout' => 3, + 'connect_timeout' => 3, + 'verify' => false, + 'headers' => [ + 'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36' + ] + ]; + + try { + $client = new Client(); + $response = $client->request('GET', $url, $options); + $httpCode = $response->getStatusCode(); + + if ($httpCode >= 200 && $httpCode < 400) { + return true; + } else { + throw new Exception('HTTP状态码异常:' . $httpCode); + } + } catch (GuzzleException $e) { + throw new Exception($e->getMessage()); } } @@ -394,59 +390,94 @@ function clearDirectory($dir): bool return true; } -function curl_client($url, $data = null, $referer = null, $cookie = null, $headers = null, $proxy = false, $method = null, $timeout = 5, $default_headers = true) +function curl_client($url, $data = null, $referer = null, $cookie = null, $headers = null, $proxy = false, $method = null, $timeout = 5) { - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - if ($default_headers === true) { - $httpheader[] = "Accept: */*"; - $httpheader[] = "Accept-Language: zh-CN,zh;q=0.8"; - $httpheader[] = "Connection: close"; - if ($headers) { - $httpheader = array_merge($headers, $httpheader); - } - } else { - $httpheader = $headers; + $options = [ + 'timeout' => $timeout, + 'connect_timeout' => $timeout, + 'allow_redirects' => false, + 'verify' => false, + 'headers' => [ + 'Content-Type' => 'application/x-www-form-urlencoded', + 'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36', + ], + 'http_errors' => false // 不抛出异常 + ]; + + // 默认请求方法 + if (!$method) { + $method = $data ? 'POST' : 'GET'; } - curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader); - curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.95 Safari/537.36"); - curl_setopt($ch, CURLOPT_HEADER, true); - if ($data) { - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, $data); + // 处理头部 + if (is_array($headers)) { + $options['headers'] = array_merge($options['headers'], $headers); } + // 处理Cookie if ($cookie) { - curl_setopt($ch, CURLOPT_COOKIE, $cookie); + $options['headers']['Cookie'] = $cookie; } + // 处理Referer if ($referer) { - curl_setopt($ch, CURLOPT_REFERER, $referer); + $options['headers']['Referer'] = $referer; } - if ($method) { - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); + // 处理数据 + if ($data) { + if ($method !== 'GET') { + $options['body'] = $data; + } else { + // 兼容已经存在查询字符串的情况 + if (!str_contains($url, '?')) { + $options['query'] = $data; + } + } } - + // 处理代理 if ($proxy) { - curl_set_proxy($ch); + $proxy_server = config_get('proxy_server'); + $proxy_port = intval(config_get('proxy_port')); + $proxy_userpwd = config_get('proxy_user').':'.config_get('proxy_pwd'); + $proxy_type = config_get('proxy_type'); + + if (empty($proxy_server) || empty($proxy_port)) { + throw new Exception('代理服务器或端口未配置'); + } + + match ($proxy_type) { + 'https' => $proxy_string = 'https://', + 'sock4' => $proxy_string = 'socks4://', + 'sock5' => $proxy_string = 'socks5://', + 'sock5h' => $proxy_string = 'socks5h://', + default => $proxy_string = 'http://', + }; + + if ($proxy_userpwd != ':') { + $proxy_string .= $proxy_userpwd . '@'; + } + + $proxy_string .= $proxy_server . ':' . $proxy_port; + $options['proxy'] = $proxy_string; } - $ret = curl_exec($ch); - $errno = curl_errno($ch); - if ($errno) { - $errmsg = curl_error($ch); - curl_close($ch); - throw new Exception('Curl error: ' . $errmsg); + try { + $client = new Client(); + $response = $client->request($method, $url, $options); + $code = $response->getStatusCode(); + + // 取重定向URL + $redirect_url = ''; + if ($code >= 300 && $code < 400) { + $redirect_url = $response->getHeaderLine('Location'); + } + + return [ + 'code' => $code, + 'redirect_url' => $redirect_url, + 'headers' => $response->getHeaders(), + 'body' => $response->getBody()->getContents() + ]; + } catch (GuzzleException $e) { + throw new Exception('请求失败: ' . $e->getMessage()); } - $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); - $headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE); - $redirect_url = curl_getinfo($ch, CURLINFO_REDIRECT_URL); - curl_close($ch); - $header = substr($ret, 0, $headerSize); - $body = substr($ret, $headerSize); - return ['code' => $httpCode, 'redirect_url' => $redirect_url, 'header' => $header, 'body' => $body]; } function curl_set_proxy(&$ch) diff --git a/app/lib/client/Ucloud.php b/app/lib/client/Ucloud.php index 4d1a9d7..23f0a1f 100644 --- a/app/lib/client/Ucloud.php +++ b/app/lib/client/Ucloud.php @@ -27,7 +27,7 @@ class Ucloud $param = array_merge($param, $params); $param['Signature'] = $this->ucloudSignature($param); $ua = sprintf("PHP/%s PHP-SDK/%s", phpversion(), self::VERSION); - $response = get_curl($this->ApiUrl, json_encode($param), 0, 0, 0, $ua, 0, ['Content-Type: application/json']); + $response = get_curl($this->ApiUrl, json_encode($param), 0, 0, $ua, 0, ['Content-Type: application/json']); $result = json_decode($response, true); if (isset($result['RetCode']) && $result['RetCode'] == 0) { return $result; diff --git a/app/lib/deploy/baishan.php b/app/lib/deploy/baishan.php index de94f51..3a4a262 100644 --- a/app/lib/deploy/baishan.php +++ b/app/lib/deploy/baishan.php @@ -56,7 +56,7 @@ class baishan implements DeployInterface $headers = []; $body = null; if ($params) { - $headers[] = 'Content-Type: application/json'; + $headers['Content-Type'] = 'application/json'; $body = json_encode($params); } $response = curl_client($url, $body, null, null, $headers, $this->proxy); diff --git a/app/lib/deploy/btwaf.php b/app/lib/deploy/btwaf.php index 402b54e..d01c67d 100644 --- a/app/lib/deploy/btwaf.php +++ b/app/lib/deploy/btwaf.php @@ -123,9 +123,9 @@ class btwaf implements DeployInterface $now_time = time(); $headers = [ - 'waf_request_time: ' . $now_time, - 'waf_request_token: ' . md5($now_time . md5($this->key)), - 'Content-Type: application/json', + 'waf_request_time' => $now_time, + 'waf_request_token' => md5($now_time . md5($this->key)), + 'Content-Type' => 'application/json', ]; $post = $params ? json_encode($params) : null; $response = curl_client($url, $post, null, null, $headers, $this->proxy, 'POST'); diff --git a/app/lib/deploy/cachefly.php b/app/lib/deploy/cachefly.php index a8ce28f..e8beeb8 100644 --- a/app/lib/deploy/cachefly.php +++ b/app/lib/deploy/cachefly.php @@ -37,10 +37,10 @@ class cachefly implements DeployInterface private function request($path, $params = null, $method = null) { $url = $this->url . $path; - $headers = ['x-cf-authorization: Bearer ' . $this->apikey]; + $headers = ['x-cf-authorization' => 'Bearer ' . $this->apikey]; $body = null; if ($params) { - $headers[] = 'Content-Type: application/json'; + $headers['Content-Type'] = 'application/json'; $body = json_encode($params); } $response = curl_client($url, $body, null, null, $headers, $this->proxy, $method); diff --git a/app/lib/deploy/cdnfly.php b/app/lib/deploy/cdnfly.php index 82a8f53..35fcf9f 100644 --- a/app/lib/deploy/cdnfly.php +++ b/app/lib/deploy/cdnfly.php @@ -44,10 +44,10 @@ class cdnfly implements DeployInterface private function request($path, $params = null, $method = null) { $url = $this->url . $path; - $headers = ['api-key: ' . $this->api_key, 'api-secret: ' . $this->api_secret]; + $headers = ['api-key' => $this->api_key, 'api-secret' => $this->api_secret]; $body = null; if ($params) { - $headers[] = 'Content-Type: application/json'; + $headers['Content-Type'] = 'application/json'; $body = json_encode($params); } $response = curl_client($url, $body, null, null, $headers, $this->proxy, $method); diff --git a/app/lib/deploy/doge.php b/app/lib/deploy/doge.php index 6c51392..597770c 100644 --- a/app/lib/deploy/doge.php +++ b/app/lib/deploy/doge.php @@ -95,13 +95,13 @@ class doge implements DeployInterface $signStr = $path . "\n" . $body; $sign = hash_hmac('sha1', $signStr, $this->SecretKey); $authorization = "TOKEN " . $this->AccessKey . ":" . $sign; - $headers = ['Authorization: ' . $authorization]; - if($body && $json) $headers[] = 'Content-Type: application/json'; + $headers = ['Authorization' => $authorization]; + if($body && $json) $headers['Content-Type'] = 'application/json'; $url = 'https://api.dogecloud.com'.$path; $response = curl_client($url, $body, null, null, $headers, $this->proxy); $result = json_decode($response['body'], true); if(isset($result['code']) && $result['code'] == 200){ - return isset($result['data']) ? $result['data'] : true; + return $result['data'] ?? true; }elseif(isset($result['msg'])){ throw new Exception($result['msg']); }else{ diff --git a/app/lib/deploy/gcore.php b/app/lib/deploy/gcore.php index c548a32..181ff63 100644 --- a/app/lib/deploy/gcore.php +++ b/app/lib/deploy/gcore.php @@ -42,10 +42,10 @@ class gcore implements DeployInterface private function request($path, $params = null, $method = null) { $url = $this->url . $path; - $headers = ['Authorization: APIKey ' . $this->apikey]; + $headers = ['Authorization' => 'APIKey ' . $this->apikey]; $body = null; if ($params) { - $headers[] = 'Content-Type: application/json'; + $headers['Content-Type'] = 'application/json'; $body = json_encode($params); } $response = curl_client($url, $body, null, null, $headers, $this->proxy, $method); diff --git a/app/lib/deploy/goedge.php b/app/lib/deploy/goedge.php index 4ef0559..e08f636 100644 --- a/app/lib/deploy/goedge.php +++ b/app/lib/deploy/goedge.php @@ -119,19 +119,19 @@ class goedge implements DeployInterface $body = null; if ($this->accessToken) { if ($this->systype == '1') { - $headers[] = 'X-Cloud-Access-Token: ' . $this->accessToken; + $headers['X-Cloud-Access-Token'] = $this->accessToken; } else { - $headers[] = 'X-Edge-Access-Token: ' . $this->accessToken; + $headers['X-Edge-Access-Token'] = $this->accessToken; } } if ($params) { - $headers[] = 'Content-Type: application/json'; + $headers['Content-Type'] = 'application/json'; $body = json_encode($params); } $response = curl_client($url, $body, null, null, $headers, $this->proxy); $result = json_decode($response['body'], true); if (isset($result['code']) && $result['code'] == 200) { - return isset($result['data']) ? $result['data'] : null; + return $result['data'] ?? null; } elseif (isset($result['message'])) { throw new Exception($result['message']); } else { diff --git a/app/lib/deploy/kangle.php b/app/lib/deploy/kangle.php index c8e15a8..89c8c5a 100644 --- a/app/lib/deploy/kangle.php +++ b/app/lib/deploy/kangle.php @@ -117,8 +117,8 @@ class kangle implements DeployInterface $response = curl_client($url, null, null, null, null, $this->proxy); if ($response['code'] == 302 && !empty($response['redirect_url'])) { $cookie = ''; - if (preg_match_all('/Set-Cookie: (.*);/iU', $response['header'], $matchs)) { - foreach ($matchs[1] as $val) { + if (isset($response['headers']['Set-Cookie'])) { + foreach ($response['headers']['Set-Cookie'] as $val) { $arr = explode('=', $val); if ($arr[1] == '' || $arr[1] == 'deleted') continue; $cookie .= $val . '; '; @@ -168,8 +168,8 @@ class kangle implements DeployInterface $response = curl_client($url, http_build_query($post), $referer, null, null, $this->proxy); if ($response['code'] == 302) { $cookie = ''; - if (preg_match_all('/Set-Cookie: (.*);/iU', $response['header'], $matchs)) { - foreach ($matchs[1] as $val) { + if (isset($response['headers']['Set-Cookie'])) { + foreach ($response['headers']['Set-Cookie'] as $val) { $arr = explode('=', $val); if ($arr[1] == '' || $arr[1] == 'deleted') continue; $cookie .= $val . '; '; diff --git a/app/lib/deploy/kangleadmin.php b/app/lib/deploy/kangleadmin.php index 35d223b..c3cb696 100644 --- a/app/lib/deploy/kangleadmin.php +++ b/app/lib/deploy/kangleadmin.php @@ -108,8 +108,8 @@ class kangleadmin implements DeployInterface $response = curl_client($url, null, null, null, null, $this->proxy); if ($response['code'] == 302 && !empty($response['redirect_url'])) { $cookie = ''; - if (preg_match_all('/Set-Cookie: (.*);/iU', $response['header'], $matchs)) { - foreach ($matchs[1] as $val) { + if (isset($response['headers']['Set-Cookie'])) { + foreach ($response['headers']['Set-Cookie'] as $val) { $arr = explode('=', $val); if ($arr[1] == '' || $arr[1] == 'deleted') continue; $cookie .= $val . '; '; diff --git a/app/lib/deploy/kuocai.php b/app/lib/deploy/kuocai.php index 7449d9e..e205d22 100644 --- a/app/lib/deploy/kuocai.php +++ b/app/lib/deploy/kuocai.php @@ -73,7 +73,7 @@ class kuocai implements DeployInterface $url = 'https://kuocai.cn' . $path; $body = $json ? json_encode($params) : $params; $headers = []; - if ($json) $headers[] = 'Content-Type: application/json'; + if ($json) $headers['Content-Type'] = 'application/json'; $response = curl_client( $url, $body, diff --git a/app/lib/deploy/lecdn.php b/app/lib/deploy/lecdn.php index 45cdc4f..f30dead 100644 --- a/app/lib/deploy/lecdn.php +++ b/app/lib/deploy/lecdn.php @@ -76,16 +76,16 @@ class lecdn implements DeployInterface $headers = []; $body = null; if ($this->accessToken) { - $headers[] = 'Authorization: Bearer ' . $this->accessToken; + $headers['Authorization'] = 'Bearer ' . $this->accessToken; } if ($params) { - $headers[] = 'Content-Type: application/json;charset=UTF-8'; + $headers['Content-Type'] = 'application/json;charset=UTF-8'; $body = json_encode($params); } $response = curl_client($url, $body, null, null, $headers, $this->proxy, $method); $result = json_decode($response['body'], true); if (isset($result['code']) && $result['code'] == 200) { - return isset($result['data']) ? $result['data'] : null; + return $result['data'] ?? null; } elseif (isset($result['message'])) { throw new Exception($result['message']); } else { diff --git a/app/lib/deploy/mwpanel.php b/app/lib/deploy/mwpanel.php index f3fdc6a..f536f57 100644 --- a/app/lib/deploy/mwpanel.php +++ b/app/lib/deploy/mwpanel.php @@ -118,8 +118,8 @@ class mwpanel implements DeployInterface $url = $this->url . $path; $headers = [ - 'app-id: '.$this->appid, - 'app-secret: '.$this->appsecret, + 'app-id' => $this->appid, + 'app-secret' => $this->appsecret, ]; $response = curl_client($url, $params ? http_build_query($params) : null, null, null, $headers, $this->proxy); return $response['body']; diff --git a/app/lib/deploy/opanel.php b/app/lib/deploy/opanel.php index 7082959..92cdc83 100644 --- a/app/lib/deploy/opanel.php +++ b/app/lib/deploy/opanel.php @@ -96,15 +96,15 @@ class opanel implements DeployInterface $timestamp = time() . ''; $token = md5('1panel' . $this->key . $timestamp); $headers = [ - '1Panel-Token: ' . $token, - '1Panel-Timestamp: ' . $timestamp + '1Panel-Token' => $token, + '1Panel-Timestamp' => $timestamp ]; $body = $params ? json_encode($params) : '{}'; - if ($body) $headers[] = 'Content-Type: application/json'; + if ($body) $headers['Content-Type'] = 'application/json'; $response = curl_client($url, $body, null, null, $headers, $this->proxy); $result = json_decode($response['body'], true); if (isset($result['code']) && $result['code'] == 200) { - return isset($result['data']) ? $result['data'] : null; + return $result['data'] ?? null; } elseif (isset($result['message'])) { throw new Exception($result['message']); } else { diff --git a/app/lib/deploy/proxmox.php b/app/lib/deploy/proxmox.php index c43f84b..f586afc 100644 --- a/app/lib/deploy/proxmox.php +++ b/app/lib/deploy/proxmox.php @@ -59,7 +59,7 @@ class proxmox implements DeployInterface private function send_request($path, $params = null) { $url = $this->url . $path; - $headers = ['Authorization: PVEAPIToken=' . $this->api_user . '=' . $this->api_key]; + $headers = ['Authorization' => 'PVEAPIToken=' . $this->api_user . '=' . $this->api_key]; $post = $params ? http_build_query($params) : null; $response = curl_client($url, $post, null, null, $headers, $this->proxy); if ($response['code'] == 200) { @@ -75,12 +75,7 @@ class proxmox implements DeployInterface throw new Exception('返回数据解析失败'); } } else { - $header = getSubstr($response['header'], ' ', "\r\n"); - if ($header) { - throw new Exception($header); - } else { - throw new Exception('请求失败(httpCode=' . $response['code'] . ')'); - } + throw new Exception('请求失败(httpCode=' . $response['code'] . ', body=' . $response['body'] . ')'); } } diff --git a/app/lib/deploy/ratpanel.php b/app/lib/deploy/ratpanel.php index 8e75477..4b272fb 100644 --- a/app/lib/deploy/ratpanel.php +++ b/app/lib/deploy/ratpanel.php @@ -114,9 +114,9 @@ class ratpanel implements DeployInterface $body = $method == 'GET' ? null : json_encode($params); $sign = $this->signRequest($method, $url, $body, $this->id, $this->token); $response = curl_client($url, $body, null, null, [ - 'Content-Type: application/json', - 'X-Timestamp: ' . $sign['timestamp'], - 'Authorization: HMAC-SHA256 Credential=' . $sign['id'] . ', Signature=' . $sign['signature'] + 'Content-Type' => 'application/json', + 'X-Timestamp' => $sign['timestamp'], + 'Authorization' => 'HMAC-SHA256 Credential=' . $sign['id'] . ', Signature=' . $sign['signature'] ], $this->proxy, $method); return $response['body']; } @@ -130,7 +130,7 @@ class ratpanel implements DeployInterface // 规范化路径 $canonicalPath = $path; - if (strpos($path, '/api') !== 0) { + if (!str_starts_with($path, '/api')) { $apiPos = strpos($path, '/api'); if ($apiPos !== false) { $canonicalPath = substr($path, $apiPos); diff --git a/app/lib/deploy/safeline.php b/app/lib/deploy/safeline.php index 569336f..e932033 100644 --- a/app/lib/deploy/safeline.php +++ b/app/lib/deploy/safeline.php @@ -83,16 +83,16 @@ class safeline implements DeployInterface private function request($path, $params = null) { $url = $this->url . $path; - $headers = ['X-SLCE-API-TOKEN: ' . $this->token]; + $headers = ['X-SLCE-API-TOKEN' => $this->token]; $body = null; if ($params) { - $heders[] = 'Content-Type: application/json'; + $headers['Content-Type'] = 'application/json'; $body = json_encode($params); } $response = curl_client($url, $body, null, null, $headers, $this->proxy); $result = json_decode($response['body'], true); if ($response['code'] == 200 && $result) { - return isset($result['data']) ? $result['data'] : null; + return $result['data'] ?? null; } else { throw new Exception(!empty($result['msg']) ? $result['msg'] : '请求失败(httpCode=' . $response['code'] . ')'); } diff --git a/app/lib/deploy/upyun.php b/app/lib/deploy/upyun.php index 9e9520e..c14e776 100644 --- a/app/lib/deploy/upyun.php +++ b/app/lib/deploy/upyun.php @@ -101,8 +101,8 @@ class upyun implements DeployInterface $result = json_decode($response['body'], true); if (isset($result['data']['result']) && $result['data']['result'] == true) { $cookie = ''; - if (preg_match_all('/Set-Cookie: (.*);/iU', $response['header'], $matchs)) { - foreach ($matchs[1] as $val) { + if (isset($response['headers']['Set-Cookie'])) { + foreach ($response['headers']['Set-Cookie'] as $val) { $arr = explode('=', $val); if ($arr[1] == '' || $arr[1] == 'deleted') continue; $cookie .= $val . '; '; diff --git a/app/lib/deploy/wangsu.php b/app/lib/deploy/wangsu.php index fa7e2b0..77657a3 100644 --- a/app/lib/deploy/wangsu.php +++ b/app/lib/deploy/wangsu.php @@ -273,7 +273,7 @@ class wangsu implements DeployInterface } elseif ($cert_name == $cert['name']) { $this->log('证书' . $cert_name . '已存在,但序列号(' . $cert['certificate-id'] . ')不匹配,准备重新上传'); try { - $this->request('/api/certificate/' . $cert['certificate-id'], [['name'] => $cert_name . '-bak'], true, null, 'PUT'); + $this->request('/api/certificate/' . $cert['certificate-id'], ['name' => $cert_name . '-bak'], true, null, 'PUT'); } catch (Exception $e) { throw new Exception('证书更名失败:' . $e->getMessage()); } @@ -416,29 +416,29 @@ class wangsu implements DeployInterface if (empty($headers)) { $headers = [ - 'Authorization: ' . $authorization, - 'Date: ' . $date, - 'Accept: application/json', - 'Connection: close', + 'Authorization' => $authorization, + 'Date' => $date, + 'Accept' => 'application/json', + 'Connection' => 'close', ]; } else { - $headers[] = 'Authorization: ' . $authorization; - $headers[] = 'Date: ' . $date; - $headers[] = 'Accept: application/json'; - $headers[] = 'Connection: close'; + $headers['Authorization'] = $authorization; + $headers['Date'] = $date; + $headers['Accept'] = 'application/json'; + $headers['Connection'] = 'close'; } if ($body && $json) { - $headers[] = 'Content-Type: application/json'; + $headers['Content-Type'] = 'application/json'; } $url = 'https://open.chinanetcenter.com' . $path; - $response = curl_client($url, $body, null, null, $headers, $this->proxy, $method, 30, false); + $response = curl_client($url, $body, null, null, $headers, $this->proxy, $method, 30); $result = json_decode($response['body'], true); if ((isset($response['code']) && $response['code'] == 201) || (isset($response['code']) && $response['code'] == 200 && $getLocation === true)) { - if (preg_match('/Location:\s*(.*)/i', $response['header'], $matches)) { - $location = trim($matches[1]); // 提取 Location 头部的值并去除多余空格 + if (isset($response['headers']['Location'])) { + $location = trim(array_shift($response['headers']['Location'])); // 提取 Location 头部的值并去除多余空格 if (!empty($location)) { return $location; } diff --git a/app/lib/dns/powerdns.php b/app/lib/dns/powerdns.php index d978d17..d03813e 100644 --- a/app/lib/dns/powerdns.php +++ b/app/lib/dns/powerdns.php @@ -369,7 +369,7 @@ class powerdns implements DnsInterface private function send_reuqest($method, $path, $params = null) { $url = $this->url . $path; - $headers[] = 'X-API-Key: ' . $this->apikey; + $headers['X-API-Key'] = $this->apikey; $body = null; if ($method == 'GET' || $method == 'DELETE') { if ($params) { @@ -377,7 +377,7 @@ class powerdns implements DnsInterface } } else { $body = json_encode($params); - $headers[] = 'Content-Type: application/json'; + $headers['Content-Type'] = 'application/json'; } try { $response = curl_client($url, $body, null, null, $headers, $this->proxy, $method); @@ -404,6 +404,5 @@ class powerdns implements DnsInterface private function setError($message) { $this->error = $message; - //file_put_contents('logs.txt',date('H:i:s').' '.$message."\r\n", FILE_APPEND); } } diff --git a/app/service/OptimizeService.php b/app/service/OptimizeService.php index 1e73777..ced2048 100644 --- a/app/service/OptimizeService.php +++ b/app/service/OptimizeService.php @@ -57,7 +57,7 @@ class OptimizeService 'key' => config_get('optimize_ip_key', 'o1zrmHAF'), 'type' => $ip_type, ]; - $response = get_curl($url, json_encode($params), 0, 0, 0, 0, 0, ['Content-Type: application/json; charset=UTF-8']); + $response = get_curl($url, json_encode($params), 0, 0, 0, 0, ['Content-Type: application/json; charset=UTF-8']); $arr = json_decode($response, true); if (isset($arr['code']) && $arr['code'] == 200) { return $arr['info']; diff --git a/app/utils/CheckUtils.php b/app/utils/CheckUtils.php index fea5529..192cb9e 100644 --- a/app/utils/CheckUtils.php +++ b/app/utils/CheckUtils.php @@ -2,76 +2,72 @@ namespace app\utils; +use GuzzleHttp\Client; +use GuzzleHttp\Exception\GuzzleException; + class CheckUtils { public static function curl($url, $timeout, $ip = null, $proxy = false) { $status = true; $errmsg = null; + $start = microtime(true); + $urlarr = parse_url($url); if (!$urlarr) { return ['status' => false, 'errmsg' => 'Invalid URL', 'usetime' => 0]; } - if (str_starts_with($urlarr['host'], '[') && str_ends_with($urlarr['host'], ']')) { - $urlarr['host'] = substr($urlarr['host'], 1, -1); - } - if (!empty($ip) && !filter_var($urlarr['host'], FILTER_VALIDATE_IP) && filter_var($ip, FILTER_VALIDATE_IP)) { - $port = $urlarr['port'] ?? ($urlarr['scheme'] == 'https' ? 443 : 80); - $resolve = $urlarr['host'] . ':' . $port . ':' . $ip; - } - $ch = curl_init(); + + $options = [ + 'timeout' => $timeout, + 'connect_timeout' => $timeout, + 'verify' => false, + 'headers' => [ + 'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36' + ], + 'http_errors' => false // 不抛出异常 + ]; + + // 处理代理 if ($proxy) { $proxy_server = config_get('proxy_server'); $proxy_port = intval(config_get('proxy_port')); $proxy_userpwd = config_get('proxy_user').':'.config_get('proxy_pwd'); $proxy_type = config_get('proxy_type'); - if ($proxy_type == 'https') { - $proxy_type = CURLPROXY_HTTPS; - } elseif ($proxy_type == 'sock4') { - $proxy_type = CURLPROXY_SOCKS4; - } elseif ($proxy_type == 'sock5') { - $proxy_type = CURLPROXY_SOCKS5; - } elseif ($proxy_type == 'sock5h') { - $proxy_type = CURLPROXY_SOCKS5_HOSTNAME; - } else { - $proxy_type = CURLPROXY_HTTP; + + if (!empty($proxy_server) && !empty($proxy_port)) { + match ($proxy_type) { + 'https' => $proxy_string = 'https://', + 'sock4' => $proxy_string = 'socks4://', + 'sock5' => $proxy_string = 'socks5://', + 'sock5h' => $proxy_string = 'socks5h://', + default => $proxy_string = 'http://', + }; + + if ($proxy_userpwd != ':') { + $proxy_string .= $proxy_userpwd . '@'; + } + + $proxy_string .= $proxy_server . ':' . $proxy_port; + $options['proxy'] = $proxy_string; } - curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_BASIC); - curl_setopt($ch, CURLOPT_PROXY, $proxy_server); - curl_setopt($ch, CURLOPT_PROXYPORT, $proxy_port); - if ($proxy_userpwd != ':') { - curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxy_userpwd); + } + + try { + $client = new Client(); + $response = $client->request('GET', $url, $options); + $httpcode = $response->getStatusCode(); + + if ($httpcode < 200 || $httpcode >= 400) { + $status = false; + $errmsg = 'http_code=' . $httpcode; } - curl_setopt($ch, CURLOPT_PROXYTYPE, $proxy_type); - } - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); - $httpheader[] = "Accept: */*"; - $httpheader[] = "Accept-Language: zh-CN,zh;q=0.8"; - $httpheader[] = "Connection: close"; - curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader); - curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); - curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); - if (!empty($resolve)) { - curl_setopt($ch, CURLOPT_DNS_USE_GLOBAL_CACHE, false); - curl_setopt($ch, CURLOPT_RESOLVE, [$resolve]); - } - curl_exec($ch); - $errno = curl_errno($ch); - if ($errno) { + } catch (GuzzleException $e) { $status = false; - $errmsg = curl_error($ch); + $errmsg = $e->getMessage(); } - $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); - if ($status && ($httpcode < 200 || $httpcode >= 400)) { - $status = false; - $errmsg = 'http_code='.$httpcode; - } - $usetime = round(curl_getinfo($ch, CURLINFO_TOTAL_TIME) * 1000); - curl_close($ch); + + $usetime = round((microtime(true) - $start) * 1000); return ['status' => $status, 'errmsg' => $errmsg, 'usetime' => $usetime]; } diff --git a/app/utils/DnsQueryUtils.php b/app/utils/DnsQueryUtils.php index e5a9591..74f9fb9 100644 --- a/app/utils/DnsQueryUtils.php +++ b/app/utils/DnsQueryUtils.php @@ -44,7 +44,7 @@ class DnsQueryUtils $data = get_curl($url); $arr = json_decode($data, true); if (!$arr) { - unset($doh_servers[$id]); + unset(self::$doh_servers[$id]); $id = array_rand(self::$doh_servers); $url = self::$doh_servers[$id].'?name='.urlencode($domain).'&type='.$dns_type[$type]; $data = get_curl($url); diff --git a/app/utils/MsgNotice.php b/app/utils/MsgNotice.php index 937eb35..6e251fe 100644 --- a/app/utils/MsgNotice.php +++ b/app/utils/MsgNotice.php @@ -220,12 +220,12 @@ class MsgNotice if (!$wechat_apptoken || !$wechat_appuid) return false; $url = 'https://wxpusher.zjiecode.com/api/send/message'; $post = ['appToken' => $wechat_apptoken, 'content' => $content, 'summary' => $title, 'contentType' => 3, 'uids' => [$wechat_appuid]]; - $result = get_curl($url, json_encode($post), 0, 0, 0, 0, 0, ['Content-Type: application/json; charset=UTF-8']); + $result = get_curl($url, json_encode($post), 0, 0, 0, 0, ['Content-Type: application/json; charset=UTF-8']); $arr = json_decode($result, true); if (isset($arr['success']) && $arr['success'] == true) { return true; } else { - return isset($arr['msg']) ? $arr['msg'] : '请求失败'; + return $arr['msg'] ?? '请求失败'; } } @@ -248,7 +248,7 @@ class MsgNotice if (isset($arr['ok']) && $arr['ok'] == true) { return true; } else { - return isset($arr['description']) ? $arr['description'] : '请求失败'; + return $arr['description'] ?? '请求失败'; } } @@ -284,12 +284,12 @@ class MsgNotice } else { return '不支持的Webhook地址'; } - $result = get_curl($url, json_encode($post), 0, 0, 0, 0, 0, ['Content-Type: application/json; charset=UTF-8']); + $result = get_curl($url, json_encode($post), 0, 0, 0, 0, ['Content-Type: application/json; charset=UTF-8']); $arr = json_decode($result, true); if (isset($arr['errcode']) && $arr['errcode'] == 0 || isset($arr['code']) && $arr['code'] == 0) { return true; } else { - return isset($arr['errmsg']) ? $arr['errmsg'] : (isset($arr['msg']) ? $arr['msg'] : '请求失败'); + return $arr['errmsg'] ?? (isset($arr['msg']) ? $arr['msg'] : '请求失败'); } } diff --git a/composer.json b/composer.json index f1e78b2..87f8329 100644 --- a/composer.json +++ b/composer.json @@ -42,23 +42,24 @@ ], "require": { "php": ">=8.2.0", - "ext-pdo": "*", - "ext-gd": "*", "ext-curl": "*", - "ext-openssl": "*", - "ext-sockets": "*", - "ext-mbstring": "*", - "ext-ssh2": "*", "ext-ftp": "*", - "topthink/framework": "^8.1.0", - "topthink/think-orm": "^4.0", - "topthink/think-view": "^2.0", + "ext-gd": "*", + "ext-mbstring": "*", + "ext-openssl": "*", + "ext-pdo": "*", + "ext-sockets": "*", + "ext-ssh2": "*", + "cccyun/php-whois": "^1.0", "cccyun/think-captcha": "^3.0", + "guzzlehttp/guzzle": "^7.0", "symfony/polyfill-intl-idn": "^1.32", "symfony/polyfill-mbstring": "^1.32", "symfony/polyfill-php81": "^1.32", "symfony/polyfill-php82": "^1.32", - "cccyun/php-whois": "^1.0" + "topthink/framework": "^8.1.0", + "topthink/think-orm": "^4.0", + "topthink/think-view": "^2.0" }, "require-dev": { "symfony/var-dumper": "^7.3", diff --git a/composer.lock b/composer.lock index 6c86cd8..08fc4b3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2bcaddab4080072a6f111b050f345d2d", + "content-hash": "d3743583cd5551b93f41500ff9dc998b", "packages": [ { "name": "cccyun/php-whois", @@ -118,6 +118,331 @@ }, "time": "2025-04-26T08:37:18+00:00" }, + { + "name": "guzzlehttp/guzzle", + "version": "7.9.3", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", + "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^1.5.3 || ^2.0.3", + "guzzlehttp/psr7": "^2.7.0", + "php": "^7.2.5 || ^8.0", + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "ext-curl": "*", + "guzzle/client-integration-tests": "3.0.2", + "php-http/message-factory": "^1.1", + "phpunit/phpunit": "^8.5.39 || ^9.6.20", + "psr/log": "^1.1 || ^2.0 || ^3.0" + }, + "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "psr-18", + "psr-7", + "rest", + "web service" + ], + "support": { + "issues": "https://github.com/guzzle/guzzle/issues", + "source": "https://github.com/guzzle/guzzle/tree/7.9.3" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", + "type": "tidelift" + } + ], + "time": "2025-03-27T13:37:11+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/7c69f28996b0a6920945dd20b3857e499d9ca96c", + "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "support": { + "issues": "https://github.com/guzzle/promises/issues", + "source": "https://github.com/guzzle/promises/tree/2.2.0" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", + "type": "tidelift" + } + ], + "time": "2025-03-27T13:27:01+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "2.7.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/c2270caaabe631b3b44c85f99e5a04bbb8060d16", + "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 || ^2.0", + "ralouphie/getallheaders": "^3.0" + }, + "provide": { + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "http-interop/http-factory-tests": "0.9.0", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" + }, + "suggest": { + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "support": { + "issues": "https://github.com/guzzle/psr7/issues", + "source": "https://github.com/guzzle/psr7/tree/2.7.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "time": "2025-03-27T12:30:47+00:00" + }, { "name": "psr/container", "version": "2.0.2", @@ -171,6 +496,113 @@ }, "time": "2021-11-05T16:47:00+00:00" }, + { + "name": "psr/http-client", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-client.git", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ], + "support": { + "source": "https://github.com/php-fig/http-client" + }, + "time": "2023-09-23T14:17:50+00:00" + }, + { + "name": "psr/http-factory", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory" + }, + "time": "2024-04-15T12:06:14+00:00" + }, { "name": "psr/http-message", "version": "1.1", @@ -325,6 +757,117 @@ }, "time": "2021-10-29T13:26:27+00:00" }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, + "time": "2019-03-08T08:55:37+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62", + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.6-dev" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.6.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:21:43+00:00" + }, { "name": "symfony/polyfill-intl-idn", "version": "v1.32.0", @@ -1101,73 +1644,6 @@ }, "time": "2025-03-23T07:31:41+00:00" }, - { - "name": "symfony/deprecation-contracts", - "version": "v3.6.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62", - "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62", - "shasum": "" - }, - "require": { - "php": ">=8.1" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/contracts", - "name": "symfony/contracts" - }, - "branch-alias": { - "dev-main": "3.6-dev" - } - }, - "autoload": { - "files": [ - "function.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "A generic function and convention to trigger deprecation notices", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.6.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-09-25T14:21:43+00:00" - }, { "name": "symfony/var-dumper", "version": "v7.3.0", @@ -1311,14 +1787,14 @@ "prefer-lowest": false, "platform": { "php": ">=8.2.0", - "ext-pdo": "*", - "ext-gd": "*", "ext-curl": "*", - "ext-openssl": "*", - "ext-sockets": "*", + "ext-ftp": "*", + "ext-gd": "*", "ext-mbstring": "*", - "ext-ssh2": "*", - "ext-ftp": "*" + "ext-openssl": "*", + "ext-pdo": "*", + "ext-sockets": "*", + "ext-ssh2": "*" }, "platform-dev": {}, "plugin-api-version": "2.6.0"