by Antonio Linares » Sun Feb 16, 2020 11:31 am
- Code: Select all Expand view
function Main()
local n
for n = 1 to 10
hb_threadStart( @ReadWeb() )
next
InKey( 0.1 )
return nil
function ReadWeb()
local oHttp := win_oleCreateObject( "MSXML2.XMLHTTP" ) // "MSXML2.ServerXMLHTTP" )
ErrorBlock( { | o | AP_RPuts( "From thread: " + Str( hb_threadId() ) + "<br>" ),;
AP_RPuts( GetErrorInfo( o ) ),;
AP_RPuts( "<hr>" ), __Quit() } )
oHttp:Open( "GET", "http://localhost/modharbour_samples/info.prg", .T. ) // synchronous
oHttp:setRequestHeader( "pragma", "no-cache" )
oHttp:setRequestHeader( "Cache-Control", "no-cache, no-store" )
oHttp:SetRequestHeader( "Accept", "*/*" )
oHttp:SetRequestHeader( "Content-Type", "application/x-www-form-urlencoded" )
oHttp:Send()
// while oHttp:readyState != 4
// oHttp:WaitForResponse( 1000 )
// end
? oHttp:ResponseText
// ? oHttp:getAllResponseHeaders()
// ? oHttp:Status
? oHttp:ClassName()
return nil