Hallo liebe AutoIT Gemeinde,
ich schaffe es einfach nicht mit der Methode InetGet auf meinen Webserver zuzugreifen.
Hier will ich auf einen per htaccess geschützten Bereich zugreifen.
Die Funktion dafür habe ich mir aus der AutoIT Hilfe geholt. (Siehe: https://www.autoitscript.com/autoit3/docs/functions/InetGet.htm)
#include <InetConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>
; Download a file in the background.
; Wait for the download to complete.
Example()
Func Example()
; Save the downloaded file to the temporary folder.
Local $sFilePath = _WinAPI_GetTempFileName(@TempDir)
; Download the file in the background with the selected option of 'force a reload from the remote site.'
Local $hDownload = InetGet("http://www.autoitscript.com/autoit3/files/beta/update.dat", $sFilePath, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)
; Wait for the download to complete by monitoring when the 2nd index value of InetGetInfo returns True.
Do
Sleep(250)
Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE)
; Retrieve the number of total bytes received and the filesize.
Local $iBytesSize = InetGetInfo($hDownload, $INET_DOWNLOADREAD)
Local $iFileSize = FileGetSize($sFilePath)
; Close the handle returned by InetGet.
InetClose($hDownload)
; Display details about the total number of bytes read and the filesize.
MsgBox($MB_SYSTEMMODAL, "", "The total download size: " & $iBytesSize & @CRLF & _
"The total filesize: " & $iFileSize)
; Delete the file.
FileDelete($sFilePath)
EndFunc ;==>Example
Alles anzeigen
Den Serverlink gebe ich mit meinem Benutzernamen und meinem Passwort nach der Art benutzer:passwort@server.de ein.
Leider meldet mir anschließend die MsgBox immer, dass 0 Bytes gedownloadet wurden.
Ein http:// davor zu setzen ändert nichts.
Gebe ich den Link benutzer:passwort@wpXXXXXX.server-he.de/html/test/Test.txt in meinen Chrome Browser ein, lädt er mir ohne zicken die Datei.
Nehme ich den unverschlüsselten Link von irgendeinem mit Google gesuchtem Bild funktioniert der Code ebenfalls tadellos.
Ich bin schon wirklich ratlos. Erkennt jemand von euch den Fehler?