Post data from VBscript

I have a function that should take two parameters - user and folder! I call this function from VBscript, and the parameters need to be sent using the post method. This is the Vbscript function code, from where I want to publish data:

Sub loadDocument()
Const HOST = "http://192.168.0.144/webservice13/service1.asmx/Lock?User="& PC\User & "folder="&c:\foldername
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
xmlhttp.open  "POST",HOST 
xmlhttp.send ""
End Sub

Now, when I try to execute this function, I get an error message that I have a syntax error! I assume the error in this line is:

Const HOST = "http://192.168.0.144/webservice13/service1.asmx/Lock?User="& PC\User & "folder="&c:\foldername

How can I solve this, how can I send two variables to this function? Thank!

+3
source share
2 answers

I think you cannot declare a Const variable with variable parts. Change the line to

dim userVar, folderVar, HOST

userVar = "PC\User"
folderVar = "c:\foldername"

HOST = "http://192.168.0.144/webservice13/service1.asmx/Lock?User=" & userVar & "&folder=" & folderVar
+3
source

, PC\User c:\foldername, HOST, URL Encoded

& . "folder=", "&folder=".

+1

Source: https://habr.com/ru/post/1729869/


All Articles