下载的网站有证书,请问这句URL_SESSION = INTERNETOPENURL(URL_OPEN,INTER_URL,"",2,16,
cRemoteFile = "https://inv-veri.chinatax.cLocalFile="增值税电子发票阅读器.zip"
URL_DOWNFILE(cRemoteFile,cLocalFile)
retu
FUNCTION URL_DOWNFILE
LPARAMETERS INTER_URL,LOCALFILE
DECLARE INTEGER InternetOpen IN wininet STRING, INTEGER, STRING, STRING, STRING
DECLARE INTEGER InternetOpenUrl IN wininet INTEGER, STRING, STRING, INTEGER, INTEGER, INTEGER
DECLARE INTEGER HttpQueryInfo IN wininet INTEGER, INTEGER, STRING @, INTEGER @, INTEGER @
DECLARE INTEGER InternetReadFile IN wininet INTEGER, STRING @, INTEGER, INTEGER @
DECLARE INTEGER InternetCloseHandle IN wininet INTEGER
URL_OPEN = INTERNETOPEN("qm3d",1,CHR(0),CHR(0),0)
IF URL_OPEN = 0
RETURN -1
ENDIF
URL_SESSION = INTERNETOPENURL(URL_OPEN,INTER_URL,"",2,16,0)
IF URL_SESSION = 0
= INTERNETCLOSEHANDLE(URL_OPEN)
RETURN -2
ENDIF
URL_FOPEN = FCREATE(LOCALFILE)
IF URL_FOPEN = -1
= INTERNETCLOSEHANDLE(URL_SESSION)
= INTERNETCLOSEHANDLE(URL_OPEN)
RETURN -3
ENDIF
URL_QUERYINFO = SPACE(32)
URL_QUERYINFOLEN = LEN(URL_QUERYINFO)
IF HTTPQUERYINFO(URL_SESSION,5,@URL_QUERYINFO,@URL_QUERYINFOLEN,0) = 1
URL_FILESIZE = VAL(LEFT(URL_QUERYINFO,URL_QUERYINFOLEN))
ELSE
URL_FILESIZE = -1
ENDIF
URL_SIZESUM = 0
URL_READBUFFER = REPLICATE(CHR(0),4096)
DO WHILE .T.
URL_READBYE = 0
IF INTERNETREADFILE(URL_SESSION,@URL_READBUFFER,4096,@URL_READBYE) = 1
IF URL_READBYE = 0
EXIT
ELSE
= FWRITE(URL_FOPEN,URL_READBUFFER,URL_READBYE)
ENDIF
URL_SIZESUM = URL_SIZESUM+URL_READBYE
IF URL_FILESIZE = -1
IF URL_SIZESUM > 0001048576
WAIT WINDOW NOWAIT "正在下载 "+ALLTRIM(STR(URL_SIZESUM/0001048576,10,3))+"M……" AT sROWS()/2,SCOLS()/2-30
ELSE
WAIT WINDOW NOWAIT "正在下载 "+ALLTRIM(STR(URL_SIZESUM/1024))+"K……" AT sROWS()/2,SCOLS()/2-30
ENDIF
ELSE
IF URL_SIZESUM > 0001048576
WAIT WINDOW NOWAIT "正在下载 "+ALLTRIM(STR(URL_SIZESUM/0001048576,10,3))+"M "+STR(URL_SIZESUM/URL_FILESIZE*100,6,2)+"%……" AT sROWS()/2,SCOLS()/2-30
ELSE
WAIT WINDOW NOWAIT "正在下载 "+ALLTRIM(STR(URL_SIZESUM/1024))+"K "+STR(URL_SIZESUM/URL_FILESIZE*100,6,2)+"%……" AT sROWS()/2,SCOLS()/2-30
ENDIF
ENDIF
ELSE
EXIT
ENDIF
ENDDO
WAIT CLEAR
= FCLOSE(URL_FOPEN)
= INTERNETCLOSEHANDLE(URL_SESSION)
= INTERNETCLOSEHANDLE(URL_OPEN)
RETURN URL_SIZESUM
ENDFUNC