| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 756 人关注过本帖
标题:关于登陆百度的问题 新手求教
只看楼主 加入收藏
iamli
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-5-27
收藏
 问题点数:0 回复次数:0 
关于登陆百度的问题 新手求教
登陆百度的代码  没有错误提示 但是登陆失败
Private Function CheckValidationResult(ByVal sender As Object, ByVal certificate As X509Certificate, ByVal chain As X509Chain, ByVal sslPolicyerrors As SslPolicyErrors) As Boolean

        Return True
    End Function
main sub
Dim uristr As String = "https://passport.baidu.com?login"
        Dim Cookies As New CookieContainer
        ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3
        Dim ServerCertificateValidationCallback As New RemoteCertificateValidationCallback(AddressOf CheckValidationResult)
              Dim poststr As String = "tpl_ok=&next_target=&tpl=mn&skip_ok=&aid=&need_pay=&need_coin=&pay_method=&u=http://www.baidu.com/index.php&return_method=get&more_param=tn=leizhen&ch=12&return_type=&psp_tt=0&password=*******&safeflg=0&username=********&verifycode="
        Dim data() As Byte = Encoding.GetEncoding("GB2312").GetBytes(poststr)
        Dim request As HttpWebRequest = CType(HttpWebRequest.Create(New Uri(uristr)), HttpWebRequest)

        request.ServicePoint.Expect100Continue = False

        request.Accept = "*/*"
        request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)"
        request.Referer = "https://passport.baidu.com?login"
        request.ContentType = "application/x-www-form-urlencoded"
        request.ContentLength = data.Length
        request.KeepAlive = True
        request.CookieContainer = Cookies
        request.AllowAutoRedirect = True
        request.Timeout = 300000
        request.Method = "POST"

        Dim writer As Stream = request.GetRequestStream()
        writer.Write(data, 0, data.Length)
        writer.Flush()
        writer.Close()

        Dim response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse)

        Dim res As Stream = response.GetResponseStream()
        Dim reader As New StreamReader(res, Encoding.GetEncoding("GB2312"))
        Dim html As String = reader.ReadToEnd()

        reader.Close()
        res.Close()
        response.Close()
        Console.WriteLine(html)
        Console.ReadKey()
end sub
搜索更多相关主题的帖子: 百度 登陆 
2010-07-04 15:29
快速回复:关于登陆百度的问题 新手求教
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016334 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved