HTTPS Download File

Für allgemeine Fragen zur Programmierung mit PureBasic.
lite
Beiträge: 122
Registriert: 27.08.2012 21:08

HTTPS Download File

Beitrag von lite »

Hallo

Wegen dieser DSGVO Verordnung werden viele Internetseiten von Http auf Https umgestellt.
Bisher hab ich die Datei immer per Winapi herunter geladen.

InternetOpen_
InternetOpenUrl_
InternetReadFile_
InternetCloseHandle_
InternetCloseHandle_

Was mit der Umstellung nicht mehr funktioniert.
Wie ist es wieder möglich ?

Die Suche im Forum brachte wenig nützliches.

Grüße

Lite
Benutzeravatar
Mijikai
Beiträge: 754
Registriert: 25.09.2016 01:42

Re: HTTPS Download File

Beitrag von Mijikai »

Gibt es eine Beispiel URL ?
Soweit ist mir noch nichts aufgefallen.
Benutzeravatar
RSBasic
Admin
Beiträge: 8022
Registriert: 05.10.2006 18:55
Wohnort: Gernsbach
Kontaktdaten:

Re: HTTPS Download File

Beitrag von RSBasic »

Warum mit WinAPI?
Mit PB gehts problemlos:

Code: Alles auswählen

InitNetwork()

If ReceiveHTTPFile("https://www.rsbasic.de/downloads/live_backup_system.zip", "D:\live_backup_system.zip")
  Debug "Success"
Else
  Debug "Failed"
EndIf

Aus privaten Gründen habe ich leider nicht mehr so viel Zeit wie früher. Bitte habt Verständnis dafür.
Bild
Bild
Benutzeravatar
Mijikai
Beiträge: 754
Registriert: 25.09.2016 01:42

Re: HTTPS Download File

Beitrag von Mijikai »

RSBasic hat geschrieben:Warum mit WinAPI?
Weil PureBasic keine bzw. nur limitierte Funktionen bietet.

Es gibt z.B. keine Möglichkeit den Fortschritt eines Downloads zu ermitteln
diesen ggf. zu unterbrechen oder fortzusetzten.

Die Url: https://www.rsbasic.de/downloads/live_backup_system.zip funktioniert problemlos mit WinApi.
Benutzeravatar
mk-soft
Beiträge: 3695
Registriert: 24.11.2004 13:12
Wohnort: Germany

Re: HTTPS Download File

Beitrag von mk-soft »

Wieso?

Ergebnis = HTTPProgress(HttpVerbindung) ...
Alles ist möglich, fragt sich nur wie...
Projekte ThreadToGUI / EventDesigner V3 / OOP-BaseClass-Modul
Downloads auf MyWebspace / OneDrive
Benutzeravatar
Mijikai
Beiträge: 754
Registriert: 25.09.2016 01:42

Re: HTTPS Download File

Beitrag von Mijikai »

mk-soft hat geschrieben:Wieso?

Ergebnis = HTTPProgress(HttpVerbindung) ...
Wie soll das helfen ?

Code: Alles auswählen

#PB_Http_Success    : the download has been successfully finished.
#PB_Http_Failed     : the download has failed.
#PB_Http_Aborted    : the download has been aborted with AbortHTTP().
Es gibt keine Informationen zum aktuellen Fortschritt.
Benutzeravatar
helpy
Beiträge: 635
Registriert: 29.08.2004 13:29

Re: HTTPS Download File

Beitrag von helpy »

Carefully read the PureBasic help:
Return value

The status of the download. It can be the current number of recieved bytes or one of the following value:

Code: Alles auswählen

  #PB_Http_Success    : the download has been successfully finished.
  #PB_Http_Failed     : the download has failed.
  #PB_Http_Aborted    : the download has been aborted with AbortHTTP().
If HTTPProgress returns a negative value it is one of the constants.
If return value is positive the function returns the current number of received bytes.
Windows 10
PB Last Final / (Sometimes testing Beta versions)
Benutzeravatar
Mijikai
Beiträge: 754
Registriert: 25.09.2016 01:42

Re: HTTPS Download File

Beitrag von Mijikai »

helpy hat geschrieben:Carefully read the PureBasic help:
Return value

The status of the download. It can be the current number of recieved bytes or one of the following value:

Code: Alles auswählen

  #PB_Http_Success    : the download has been successfully finished.
  #PB_Http_Failed     : the download has failed.
  #PB_Http_Aborted    : the download has been aborted with AbortHTTP().
If HTTPProgress returns a negative value it is one of the constants.
If return value is positive the function returns the current number of received bytes.
Why in english ?
Your are right about this, but in no way does this invalidate my other points.

I also want to remind everyone that the original question was solely about WinApi !
Benutzeravatar
helpy
Beiträge: 635
Registriert: 29.08.2004 13:29

Re: HTTPS Download File

Beitrag von helpy »

Sorry!
Ich verwende grundsätzlich die englische Hilfe und bin dann in dieser Sprache geblieben.

Mit WinAPI arbeite ich recht wenig, meine Antwort bezog sich nur auf die Aussage "Es gibt keine Informationen zum aktuellen Fortschritt." und hat keineswegs die anderen Punkte in Frage gestellt.

Evt. hilft ja MSDN weiter:
==> https://msdn.microsoft.com/en-us/librar ... s.85).aspx

Das musst Du aber selbst evaluieren. Ich will mich da nicht weiter vertiefen.

Gruß,
Guido

__________________________________________________
URL-Tags hinzugefügt
21.05.2018
RSBasic
Windows 10
PB Last Final / (Sometimes testing Beta versions)
lite
Beiträge: 122
Registriert: 27.08.2012 21:08

Re: HTTPS Download File

Beitrag von lite »

@RsBasic

Danke für dein Beispiel. Es funktioniert prima.

Nur verwende ich für mein Prg PB 5.24 und alles in Winapi.
Alles umschreiben wäre ein riesen Aufwand.
Per Winapi gibt es nix ?

Grüße
Lite
Antworten