Foxtable(狐表)用户栏目专家坐堂 → [求助]HttpClient返回结果不正确


  共有1570人关注过本帖树形打印复制链接

主题:[求助]HttpClient返回结果不正确

帅哥哟,离线,有人找我吗?
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:111381 积分:566969 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2024/5/9 10:20:00 [显示全部帖子]

Dim s As String 
Dim urls As New List(Of String) From {"http://ipinfo.io/ip", "http://ifconfig.me", "http://members.3322.org/dyndns/getip", "http://myip.ipip.net"}
For Each url As String In urls
    Dim hc As New HttpClient(url)
    hc.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36"
    hc.GetInformation()
    Output.Show("【" & url & "】" & hc.StatusCode)
    If hc.StatusCode = "200" Then
        Dim a As String = hc.GetData()
        If a > "" Then
            s = "请检查数据库白名单是否含【" & url & "】返回本机ipv4地址:【" & a & "】。"
            Exit For
        End If
    End If
    hc.Close()
Next 
Output.Show("s:" & s)

 回到顶部