RosettaCodeData/Task/HTTP/M2000-Interpreter/http.m2000

30 lines
893 B
Plaintext

Module CheckIt {
Declare xml "Microsoft.XMLHTTP"
const testUrl$ = "http://www.rosettacode.org"
With xml, "readyState" as ReadyState
Method xml "Open", "Get", testUrl$, True ' True means Async
Method xml "send"
\\ We set a thread to count time
k=0
Thread {
k++
} as TimeOut interval 100
\\ In main thread we can check ReadyState and Mouse button
Task.Main 100 {
Print ReadyState
If ReadyState=4 then exit
if k>20 then exit ' 20*100= 2 sec
if mouse then exit ' exit if mouse click
}
\\ So now we can read
if ReadyState=4 then {
With xml, "responseText" AS AA$
\\ break AA$ to lines
Document BB$=AA$
\\ using line breaks as CRLF
Report BB$
}
Declare xml Nothing
}
CheckIt