PROCEDURE DownloadFromWWW
param cURL, cLocalFileName, lSilent
LOCAL oCon, oUrl, i, cResponse
local ret := .f.
local StaraObslugaBledu
BEGIN SEQUENCE with {|| break()}
cLocalFileName := alltrim(cLocalFileName)
if lSilent = NIL
lSilent := .f.
endif
oUrl := tURL():New( cUrl )
IF Empty( oUrl )
if !lSilent
MsgBox("Wrong url adress" + cUrl)
endif
BREAK
ENDIF
IF oUrl:cProto != "http"
if !lSilent
MsgBox('Wrong http adress')
endif
BREAK
END
oCon := TipClientHttp():New( oUrl )
oCon:nConnTimeout := 20000
if !lSilent
MsgBox("Connecting with "+ oUrl:cServer)
endif
IF oCon:Open( cUrl )
if !lSilent
MsgBox("Connection established." +chr(10)+"Press OK to download " + oUrl:cPath +oUrl:cFile)
endif
oCon:WriteAll(cLocalFileName)
if !lSilent
MsgBox("Downloaded and written as: "+cLocalFileName)
endif
oCon:Close()
ret := .t.
ELSE
IF oCon:SocketCon == NIL
cResponse := "Connection not initialized"
ELSEIF hb_InetErrorCode( oCon:SocketCon ) == 0
cResponse := oCon:cReply
ELSE
if !lSilent
cResponse := "Error in connection: " + hb_InetErrorDesc( oCon:SocketCon )
endif
ENDIF
if !lSilent
MsgBox("Connection can't be established: "+ oUrl:cServer+chr(10)+"Server answer: "+cResponse)
endif
ret := .f.
END
RECOVER
if !lSilent
MSGSTOP("Connection failed!")
endif
END SEQUENCE
RETURN ret
Why not Download the logo with Firefox and put in a program folder.
My one logo for desktops is called desktoplogo.jpg .... I use jpeg. I am sure you could use png.
You may need to work with it depending on size.
franco wrote: ↑Tue Mar 15, 2022 7:26 pm
Why not Download the logo with Firefox and put in a program folder.
My one logo for desktops is called desktoplogo.jpg .... I use jpeg. I am sure you could use png.
You may need to work with it depending on size.
Jimmy needs to fetch thumbnails from links that the user creates or import from .m3u files . These are not files permanently embedded in the program and are dynamicly changed for each selected record, therefore they must be downloaded in runtime.