为什么用xml提交不了?

day2008 2009-12-26 10:12:07
Private Sub Command1_Click()
Dim http As Object, q_post As String, User As String, Pass As String
Set http = CreateObject("Microsoft.XMLHTTP")
http.open "POST", "http://www.01xs.com/", False

http.setRequestHeader "Accept", "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-silverlight, */*" '表示我们所用的浏览器能接受的Content-type

http.setRequestHeader "Referer", "http://www.01xs.com" '当前页面是从那个页面链接来的

http.setRequestHeader "Accept-Language", "zh-cn" '语言

http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" '表示客户端提交给服务器文本内容的编码方式是URL编码,即除了标准字符外,每字节以双字节16进制前加个“%”表示

http.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQPinyin 689; TencentTraveler 4.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727)" '显示出本机的相关系信息,呵呵,这是我的信息大家可以去掉不用发这条

http.setRequestHeader "Host", "www.01xs.com" '所请求的主机

http.setRequestHeader "Content-Length", "90" '表示提交的数据字节大小

http.setRequestHeader "Cache-Control", "no-cache" '返回消息中的Cache用于指定网页缓存

http.setRequestHeader "Connection", "Keep-Alive" '数据传递完并不立即关闭连接

User = "ceshi"
Pass = "111aaa"

q_post = "username=" & User & "&password=" & Pass
http.send (q_post)

WebBrowser1.Navigate "http://www.01xs.com"

Set http = Nothing
End Sub


这样也不行.....
Dim info1 As String

Private Sub Command1_Click()
info1 = ""
Winsock1.Close
Winsock1.RemoteHost = "http://www.01xs.com/"
Winsock1.RemotePort = 80
Winsock1.Connect
End Sub

Private Sub Winsock1_Connect()
info1 = info1 + "POST /User/LoginCheck.aspx HTTP/1.1" + vbCrLf
info1 = info1 + "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-silverlight, */*" + vbCrLf
info1 = info1 + "Accept-Encoding: gzip, deflate" + vbCrLf
info1 = info1 + "Accept-Language: zh-cn" + vbCrLf
info1 = info1 + "Cache-Control: no-cache" + vbCrLf
info1 = info1 + "Connection: Keep-Alive" + vbCrLf
info1 = info1 + "Content-Length: 85" + vbCrLf
info1 = info1 + "Content-Type: application/x-www-form-urlencoded" + vbCrLf
info1 = info1 + "Cookie: ASP.NET_SessionId=m0o0nmn2eh5e0f450mbb5o45; WanerSoftLanguage=0; AJSTAT_ok_pages=20; AJSTAT_ok_times=2; WsChapterRead=0,408128,408150" + vbCrLf
info1 = info1 + "Host: www.01xs.com" + vbCrLf
info1 = info1 + "Referer: http://www.01xs.com/" + vbCrLf
info1 = info1 + "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQPinyin 689; TencentTraveler 4.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727)" + vbCrLf
info1 = info1 + "username=" & "ceshi" + vbCrLf
info1 = info1 + "&password=111aaa" + vbCrLf
Winsock1.SendData info1
WebBrowser1.Navigate "http://www.01xs.com"
End Sub
...全文
123 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
孤独剑_LPZ 2009-12-29
  • 打赏
  • 举报
回复
帮顶吧
day2008 2009-12-29
  • 打赏
  • 举报
回复
为什么没有人呢?
day2008 2009-12-26
  • 打赏
  • 举报
回复
求助~~~~~~~

1,502

社区成员

发帖
与我相关
我的任务
社区描述
VB 网络编程
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧