From 7bda1dbcce51092e787becb034b5e9d7dca2e2e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Thu, 30 Apr 2020 18:17:29 +0800 Subject: [PATCH] add clear --- wchat/common/HttpClient.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/wchat/common/HttpClient.php b/wchat/common/HttpClient.php index a04e5d1..7ef8097 100644 --- a/wchat/common/HttpClient.php +++ b/wchat/common/HttpClient.php @@ -311,7 +311,23 @@ class HttpClient if (!$this->checkIsIp($this->host)) { $this->host = System::gethostbyname($this->host); } - var_dump($this->host, $string); + + if ($this->isHttp($string)) { + $string = str_replace('http://', '', $string); + $hostAndUrls = explode('/', $string); + + $this->host = array_shift($hostAndUrls); + $string = implode('/', $hostAndUrls); + } else if ($this->isHttps($string)) { + $string = str_replace('https://', '', $string); + $this->setIsSSL(true); + + $hostAndUrls = explode('/', $string); + + $this->host = array_shift($hostAndUrls); + $string = implode('/', $hostAndUrls); + } + return $string; }