i want download file from our server
url example http://xxx.xxxx.xx/posdoc_download.php? ... code=40385
when i try in browser, it returns pdf file... i have no idea how to do it in purebasic
many thanks
download file
Re: download file
There are three different ways:
ReceiveHTTPFile(URL$, Filename$)
ReceiveHTTPMemory(URL$)
RunProgram(URL$)
ReceiveHTTPFile(URL$, Filename$)
ReceiveHTTPMemory(URL$)
RunProgram(URL$)
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: download file
receivehttpfile not work, i set url to my with parameters, but what with file name, i want filename which our server returns... instead of pdf, there is error html page in downloaded file
runprogram maybe ok, but it need external program ... can make problems...
runprogram maybe ok, but it need external program ... can make problems...
Re: download file
What's with this:
Code: Select all
InitNetwork()
HttpRequest = HTTPRequest(#PB_HTTP_Get, "http://xxx.xxxx.xx/posdoc_download.php?card=4322&auth=code&authcode=40385")
If HttpRequest
Debug "Statuscode: " + HTTPInfo(HTTPRequest, #PB_HTTP_StatusCode)
Debug "Header: " + HTTPInfo(HTTPRequest, #PB_HTTP_Headers)
*Response = HTTPMemory(HTTPRequest)
FinishHTTP(HTTPRequest)
If *Response
Debug "Response size: " + MemorySize(*Response)
ShowMemoryViewer(*Response, MemorySize(*Response))
FreeMemory(*Response)
EndIf
Else
Debug "Request creation failed"
EndIf