I was looking for an API alternative to URLDownloadToFile (but, to download to memory, not a file) and ran across URLOpenBlockingStream in this thread ...
https://forum.powerbasic.com/forum/u...-api-functions
The code works on a web page from my site, but not from the PowerBASIC site. Why would that be?
https://forum.powerbasic.com/forum/u...-api-functions
The code works on a web page from my site, but not from the PowerBASIC site. Why would that be?
Code:
#Compile Exe 'Jose's Headers #Debug Display On #Debug Error On #Include "WIN32API.INC" #Include "urlmon.inc" Global gTemp$ Function PBMain() Local stream As IStream, hr As Long Local buffer As AsciiZ * 500, bytesRead As Dword 'hr = URLOpenBlockingStream(Nothing, "https://forum.powerbasic.com/forum/user-to-user-discussions/powerbasic-for-dos/148-bug-in-on-line-help", stream, 0, Nothing) 'does not work hr = URLOpenBlockingStream(Nothing, "http://www.garybeene.com", stream, 0, Nothing) 'works While (stream.Read(VarPtr(buffer), 500, bytesRead) = %S_Ok) And (bytesRead >< 0) gTemp$ += buffer bytesRead = 0 Wend stream = Nothing ? gTemp$ End Function
Comment