Home > Software engineering >  Come on people to help do a post submission
Come on people to help do a post submission

Time:10-06

Originally, I don't want to directly to the code, but send post something for me to some difficult, want to do a great god help me, time is very urgent so to stretch out his hand to, some ashamed,



This is my extraction post a message, I finally click the button add 1 yuan
is the name ofIf there is a great god is willing to help me to write a code, whether important places in the code to add comment, I still want to learn,

CodePudding user response:

 
The Public Function getpages (ByVal URL As a String, Optional ByVal Data As String="") As String
Dim XML As the Object
The Set of XML=CreateObject (". WinHttp WinHttpRequest. 5.1 ")
XML. Option (6)=False
XML. Option (4)=13056
Then If Len (Data)=0
XML. Open "GET", URL
XML. Send
The Else
XML. Open "POST", URL
XML. SetRequestHeader "content-type", "application/x - WWW - form - urlencoded"
XML. SetRequestHeader "Content - Length", LenB (StrConv (Data, vbFromUnicode))
XML. Send Data
End the If
Getpages=XML. The ResponseText
The Set of XML=Nothing
End the Function

'call example
The debug. Print getpages (" http://www.wlmqtljzbw.com/ztb/TB_send.aspx ", "_EVENTVALIDATION=/asldjflsjdlfjljfsd& _VIEWSTATE=/saldlfjj& Bt_BS1=1 yuan ") 'if is that Chinese cannot directly use utf8; to transcoding

CodePudding user response:

 Function WskPost () As a Boolean 
Dim As Long I
Dim PostSu As Boolean
PostSu=False
I=0
StrCommand=""

StrCommand="POST/noticeCreate. JSP HTTP/1.1" + vbCrLf
StrCommand=StrCommand + "Accept: */*" + vbCrLf
StrCommand=StrCommand + "Accept - Language: useful - cn" + vbCrLf
StrCommand=StrCommand + Referer: "http://119.185.1.182:8888/camion.html" + vbCrLf
StrCommand=StrCommand + "x - requested - with: XMLHttpRequest" + vbCrLf
StrCommand=StrCommand + "content-type: application/x - WWW - form - urlencoded; The charset=utf-8 "+ vbCrLf
StrCommand=StrCommand + "the user-agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; The.net CLR 2.0.50727; The.net CLR 3.0.04506.648; The.net CLR 3.5.21022; The.net CLR 3.0.4506.2152; The.net CLR 3.5.30729; . NET4.0 C; . NET4.0 E; AskTbPTV2/5.9.1.14019; 360 se) "+ vbCrLf
StrCommand=StrCommand + "Host: 119.185.1.182:8888 + vbCrLf
StrCommand=StrCommand + "Content - Length:" & amp; Str (Len SendMsg ()) + vbCrLf
StrCommand=StrCommand + "Connection: Keep Alive -" + vbCrLf
StrCommand=StrCommand + "cache-control: no - Cache" + vbCrLf
'strCommand=strCommand + "Accept - Language: useful - CN, useful, *" + vbCrLf
StrCommand=StrCommand + "Accept - Encoding: gzip, deflate" + vbCrLf
StrCommand=StrCommand + vbCrLf
StrCommand=StrCommand + SendMsg + vbCrLf
If wsk1. State & lt;> SckClosed Then wsk1. Close
Wsk1. RemoteHost=Text1. Text
Wsk1. RemotePort=Text2. Text
Wsk1. Connect
The Debug. Print StrCommand
Do Until I & gt;=1000 And wsk1. State=sckOpen
'MsgBox wsk1. State
If wsk1. State=9 Then
'the stat "error", ""
PostSu=False
The Exit Do
End the If
If wsk1. State=sckConnected Then
Wsk1. SendData publishes the event StrCommand
PostSu=True
The Exit Do
End the If
I=I + 1
DoEvents
Loop
WskPost=PostSu
End the Function
  • Related