Jump to content
Sign in to follow this  

Send WinHTTP Request but don't wait for response?

Recommended Posts


So technically, to send a WinHTTP request, you have..:

$h_openRequest = _WinHttpOpenRequest($hw_connect, "GET", "/" , "HTTP/1.1", "")

$data = ''
$data &= _WinHttpReadData($h_openRequest)
Until @error

Typically, some responses may take a few seconds to load, and thus slows your script. Is there a way to send the request but not wait for the load? In other words, instead leave it to load on its own and move on with the script? Thanks!


Share this post

Link to post
Share on other sites

This is one way to do it:

ConsoleWrite("Script started" & @LF)
AdlibRegister("foo") ; register the adlib function, this does not hold up the script
ConsoleWrite("Script continues while the function is busy" & @LF)
Sleep(4000) ; keep the script from terminating for a while
ConsoleWrite("Script ended" & @LF)

Func foo()
    AdlibUnRegister("foo") ; unregister the function to avoid it being called again
    ; winhttp etc. here...
    Sleep(1000) ; simulate waiting for a response
    ConsoleWrite("I did not hold up the script :)" & @LF)
Edited by Robjong

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.