'分离成域名与路径
'网络调用里使用，因为多要把 URL 分成：域名或者IP地址与页面路径使用
Sub URL_FenLiYuMinLuJing(ByVal URL as String, ByRef domain as String, ByRef path as String, ByRef port as Integer) '分离成域名与路径
   'ByRef 域名 as String ,ByRef 路径 as String ,ByRef 端口
   Dim as String  tob,ltob
   Dim as Long  aa,bb
   tob = Trim(URL)
   ltob = LCase(tob)
   If Left(ltob, 7) = "http://" Then '去除
      tob = Mid(tob, 8)
      port = 80
      bb = 1
   ElseIf Left(ltob, 8) = "https://" Then
      tob = Mid(tob, 9)
      port = 443
      bb = 1
   Else
      If port = 0 Then port = 80
      bb = 0
   End If
   If bb = 1 Or Len(domain) = 0 Then  '带域名或 没有原域名
      '分离域名
      aa = InStr(tob, "/")
      If aa = 0 Then
         domain = Trim(tob)
         path = ""
      Else
         domain = Trim(Left(tob, aa -1))
         path = Trim(Mid(tob, aa + 1))
      End If
   Else   ' "HTTP/1.0 30" '转向 ，就用原域名
      tob = Trim(tob)
      If Left(tob, 1) = "/" Then
         path = Mid(tob, 2)
      Else
         path = tob
      End If
   End If
   
End Sub