This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
DarkenedEvil's profile picture

[HTTP] Website send download request.

Started by DarkenedEvil, 30 May 2013 - 08:11 PM
DarkenedEvil #1
Posted 30 May 2013 - 10:11 PM
Hi I recently started a new project(CCC see my signature) and I need a way for the webpage(coded in PHP) to send a download request to the computer. Let me explain a bit more.

The computer sends a request to the webpage telling it the file name. I then want the webpage to check if the file exists and then if it does send a request back to the computer saying it is downloadable and what the link is so the computer can then download it. But heres the catch I only want that one web page and one computer program doing the work for security reasons I don't want any web URL's saved on the computer.

I have tried to wrap my head around a way to implement this for a few days but simply can't think of anything. Any and all help would be much appreciated.

Thanks in advanced!
Yevano #2
Posted 30 May 2013 - 10:31 PM
You'd just want to have the page send the file in the http response. If there is no file, the response could be an error code. This sends the file directly instead of linking elsewhere. If you really need it to link elsewhere, then you'd send the link or an error code. When the computer sees the response, it makes a request to the link it gets.