Version up through 5.31 return a 0 if the requested file does not exist, as expected and described in the Help file.
I tested with Vs 5.41 and 5.43, and 5.50 and they return a 1 (success) and store a file insteadReturn value
Returns nonzero if the download was successful, zero otherwise. If #PB_HTTP_Asynchronous was specified, it returns the 'HttpConnection' value needed for HTTPProgress(), AbortHTTP() and FinishHTTP().
Try this code
Code: Select all
InitNetwork()
Filename$ = "C:\Temp\TestFile.jpg"
Result = ReceiveHTTPFile("http://www.purebasic.com/TestFile.jpg", Filename$)
If Result
MessageRequester("Debug", "ReceiveHTTPFile return a " + Str(result), #MB_ICONINFORMATION)
Else
MessageRequester("Debug", "ReceiveHTTPFile return a " + Str(result), #MB_ICONERROR)
EndIf
End
And it actually stores a file containing
Code: Select all
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /TestFile.jpg was not found on this server.</p>
<hr>
<address>Apache/2.2.22 (Debian) Server at www.purebasic.com Port 80</address>
</body></html>