vb 向服务器发送数据,返回“不能解析您的提问,提问参数为空”是什么原因?
向搜搜问问服务器发送提问内容,返回“不能解析您的提问,提问参数为空”。截获发送的数据是(UTF8):{"userId":,"":"庣绛犳按","title":"鐢佃剳鐪嬩箙浜嗭紝鐪肩潧鏈夌偣绾紝濂借薄鏈夋矙瀛愶紝鎬庝箞鍔烇紵","content":"鏈変粈涔堝ソ鏂规硶","categoryId":553648128,"anonymous":true,"orig":1001,"modify":false,"origtmpid":0,"origtablename":"","synctwitter":false,"agreeNoFree":false}
不知道是哪出问题,哪位高手帮忙看看?
代码如下:
'连接服务器
If Winsock1.State <> 0 Then Winsock1.Close
Do While Not Winsock1.State = 0
DoEvents
Loop
Host = "wenwen.soso.com"
Winsock1.RemoteHost = Host
Winsock1.RemotePort = 80 'WEB服务器端口
Winsock1.Connect
Do While Not Winsock1.State = 7
DoEvents
Loop
'发送登录请求
'Dim strCommand As String
'Dim ContentLength As Integer
Dim PostData As String
CategoryId = 559087616
PostData = Replace("{""userId"":" & Text1.text & ",""userName"":""" & Nick & """,""title"":""" & UnicodeToUTF8(Text4.text) & """,""content"":""" & UnicodeToUTF8(Text5.text) & """,""categoryId"":" & CategoryId & ",""anonymous"":true,""orig"":1001,""modify"":false,""origtmpid"":0,""origtablename"":"""",""synctwitter"":false,""agreeNoFree"":false,""vcode"":""code""}", vbCrLf, "")
ContentLength = Len(PostData)
Head = "POST /z/api/ask/submit?format=json HTTP/1.1"
strCommand = Head + vbCrLf
strCommand = strCommand + "Accept: */*" + vbCrLf
strCommand = strCommand + "Accept-Language: zh-cn" + vbCrLf
strCommand = strCommand + "Referer: http://wenwen.soso.com/z/Ask.e" + vbCrLf
strCommand = strCommand + "Content-Type: application/json; charset=UTF-8" + vbCrLf
strCommand = strCommand + "Accept-Encoding: deflate" + vbCrLf
strCommand = strCommand + "User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; QQDownload 718; .NET4.0C; .NET4.0E)" + vbCrLf
strCommand = strCommand + "Host: " + Host + vbCrLf
strCommand = strCommand + "Content-Length: " + str(ContentLength) + vbCrLf
strCommand = strCommand + "Connection: Keep-Alive" + vbCrLf
strCommand = strCommand + "Cache-Control: no-cache" + vbCrLf
strCommand = strCommand + "Cookie: " + Cookie + vbCrLf
strCommand = strCommand + vbCrLf
strCommand = strCommand + PostData & vbCrLf
Winsock1.SendData strCommand
补充:VB , 网络编程