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

Hosting Blank Webpage

Started by Xeno, 28 February 2014 - 09:37 AM
Xeno #1
Posted 28 February 2014 - 10:37 AM
I want a webpage that I can read and write data off. I have tried many hosting services but none of the allow me to write my data only read it. I have two questions. How should I make this webpage should I just make a blank html file. 2. What service should I use. I don't mind what the url is as long a its free. Or Should I host the webpage from my laptop (I can port forward).
Thank you

Xeno
tesla1889 #2
Posted 28 February 2014 - 08:38 PM
use a host which allows you to use server-side scripting, such as php

write via http://www.your-url.com/script.php?action=write&id=some_identifier&data=some_value
read via http://www.your-url.com/script.php?action=read&id=some_identifier

then, in script.php, get the input and generate the appropriate response html
Xeno #3
Posted 27 March 2014 - 08:40 AM
All I want I a way to transfer data from a Computercraft computer to a computer on another server. Also I want a way to be able to see what data is being transferred for my iPad
1lann #4
Posted 27 March 2014 - 02:36 PM
Well you're gonna need to write that yourself with a server-side scripting language. There are no sockets in CC, so you'll need to write your own system that checks for new messages every few seconds. One example is to have the server ready to receive a PHP post request, which then you can write to the a public file on the server, which in this case I'll call it the /messages.txt file. Then the other computer in the different world/server can refresh and check that file every few seconds, until it changes/whatever. You could do the same with your iPad, or even automate it with a simple HTML page that uses JavaScript to check for changes.
Bomb Bloke #5
Posted 27 March 2014 - 02:47 PM
The "easy" method is to use the built-in "pastebin" script, which you've probably already used to import scripts into your world - but it can also go the other way, and dump your data onto pastebin.com for you.

My one gripe about that is that it assumes it should set no expiry, so any old rubbish you export is out there for good.

If you want a help with a "hard" method, you're going to have to be more specific about what you're trying to upload and why. This info dictates the requirements.
CometWolf #6
Posted 27 March 2014 - 06:52 PM
You can set the expiration if you edit the pastebin program
http://pastebin.com/api#4
Xeno #7
Posted 27 March 2014 - 11:16 PM
Ignore what I have said so far. Want to have a way to write data to a web page like you would write data to a txt document with the fs API. I know there is a http.post() but when ever I use it, it doesn't post data to my webpage. I can read data fine using http.get(). The data that I will be writing will just integers. I am only 13 and have no experience with hosting webpages, although I have hosted many minecraft servers and know how to use HTML, so please keep it simple.
Thank you

Xeno
Bomb Bloke #8
Posted 28 March 2014 - 02:24 AM
For starters, no, a blank HTML file isn't going to cut it. Your server will need to be configured to expect data to be posted to it, and it'll need to know what to do with that data. You've probably noticed that there aren't many websites that just let you re-write their contents out there.

Consider how the site you want to build differs from PasteBin, and list out those differences. So far I still fail to see how that wouldn't suit your purposes. If you just want more features then the default PasteBin script offers, consider SmartPaste.

You can set the expiration if you edit the pastebin program
http://pastebin.com/api#4

Power of default, and all that. What I'm getting at is that what I "can" do has little bearing on what most people wanting to use the script are "going" to do.

It's a minor thing. Most people going through the web interface are likely hitting "no expiry" for their rubbish too, and it's none of my business really. Put it down to OCD.

While I'm on my tangent, though, you'd be amazed at the percentage of MineCraft-related pastes I come across when clicking through random entries. ComputerCraft code isn't all that uncommon, either.
twormtwo #9
Posted 28 March 2014 - 03:16 AM
Ignore what I have said so far. Want to have a way to write data to a web page like you would write data to a txt document with the fs API. I know there is a http.post() but when ever I use it, it doesn't post data to my webpage. I can read data fine using http.get(). The data that I will be writing will just integers. I am only 13 and have no experience with hosting webpages, although I have hosted many minecraft servers and know how to use HTML, so please keep it simple.
Thank you

Xeno
I believe I know what you are trying to do, but you saw Html Post and thought that must post information, but in reality, it sends a HTML POST request to the server, much like filling out a form and hitting submit. I would suggest reading the W3 manual on html get vs post (http://www.w3schools.com/tags/ref_httpmethods.asp). Once you do this, you can then set up this system you are trying to, with your new found knowledge for html information submission techniques :)/>
Sorry if this isn't the answer you were looking for, but it will definately help you in the future beyond just cc stuff.