1.

Solve : Loop in http post in vbscript / ASP?

Answer»

Good day..

How can I do request looping in request header ? Example..
I have whole day transaction stored in my database. My server will SEND all this value to another server to update payment status...
I WANT loop value for ID..
There is SYNTAX ERROR at ------- Function HTTPPost


below is my code

do while not abc.eof ' -------abc is value from my database

sUrl = "HTTPS:/qwer.com"

sRequest = "ID="&escape(a)&"&CODE="&escape(b)&"&NAME="&(strEncrypted)

HTTPPost sUrl, sRequest
Function HTTPPost(sUrl, sRequest)
Set oHTTP=Server.CreateObject("Msxml2.ServerXMLHTTP.6.0")
oHTTP.setOption 2, 13056
oHTTP.open "POST", sUrl,false
oHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
oHTTP.setRequestHeader "Content-Length", Len(sRequest)
oHTTP.send sRequest
HTTPPost = oHTTP.responseText
End Function
abc.movenext
loopMaybe I am ignorant, but I do not under stand why your have a Function defined inside a loop. But maybe things have changed since I did programming.Quote from: Geek-9pm on April 19, 2015, 10:56:28 PM

Maybe I am ignorant, but I do not under stand why your have a Function defined inside a loop. But maybe things have changed since I did programming.

You are correct. That is likely the syntax error. The Function definition will NEED to be moved outside of the loop.hehehe...sorry my mistake.....can someone show the right way todo this
Well, we are going to need more INFORMATION about what you are actually trying to do and what all the variables you are using actually represent.


Discussion

No Comment Found