Dim objExplorer, DataToPOST, Header
Set objExplorer = WScript.CreateObject("InternetExplorer.Application")
objExplorer.Visible = 1
DataToPOST = Stream_StringToBinary("x=Gia tri cua X&y=Gia tri cua Y","utf-8")
Header = "Content-Type: application/x-www-form-urlencoded"
objExplorer.Navigate "http://huypv.net/dump-post.php", Nothing, Nothing, DataToPOST, Header
Function Stream_StringToBinary(Text, CharSet)
Const adTypeText = 2
Const adTypeBinary = 1
'Create Stream object
Dim BinaryStream 'As New Stream
Set BinaryStream = CreateObject("ADODB.Stream")
'Specify stream type - we want To save text/string data.
BinaryStream.Type = adTypeText
'Specify charset For the source text (unicode) data.
If Len(CharSet) > 0 Then
BinaryStream.CharSet = CharSet
Else
BinaryStream.CharSet = "us-ascii"
End If
'Open the stream And write text/string data To the object
BinaryStream.Open
BinaryStream.WriteText Text
'Change stream type To binary
BinaryStream.Position = 0
BinaryStream.Type = adTypeBinary
'Ignore first two bytes - sign of
BinaryStream.Position = 0
'Open the stream And get binary data from the object
Stream_StringToBinary = BinaryStream.Read
End Function
Title:
VBS - Post data to URL by IE Object
Description:
Dim objExplorer, DataToPOST, Header Set objExplorer = WScript.CreateObject("InternetExplorer.Application") objExplorer.Visible ...
...
Rating:
4