Private Sub Form_Load()
Dim postData As String
Dim url As String
url = "http://blog.csdn.net/haha4799/article/details/50837123#"
postData = TextContent.Text
'--- post
Dim HttpClient As Object
Set HttpClient = CreateObject("Microsoft.XMLHTTP")
HttpClient.Open "POST", url, False
HttpClient.setRequestHeader "Content-Type", "text/xml; charset=UTF-8"
HttpClient.Send pvToByteArray(postData)
Do While HttpClient.readyState <> 4
DoEvents
Loop
TextResponse.Text = HttpClient.responseText
MsgBox "·ggg"
End Sub
Private Function pvToByteArray(sText As String) As Byte()
pvToByteArray = GB2312ToUTF8(sText)
End Function
Public Function GB2312ToUTF8(strIn As String, Optional ByVal ReturnValueType As VbVarType = vbString) As Variant
Dim adoStream As Object
Set adoStream = CreateObject("ADODB.Stream")
adoStream.Charset = "utf-8"
adoStream.Type = 2 'adTypeText
adoStream.Open
adoStream.WriteText strIn
adoStream.Position = 0
adoStream.Type = 1 'adTypeBinary
GB2312ToUTF8 = adoStream.Read()
adoStream.Close
If ReturnValueType = vbString Then GB2312ToUTF8 = Mid(GB2312ToUTF8, 1)
End Function