Jump to content




Hosting Blank Webpage

api networking computer

8 replies to this topic

#1 Xeno

  • Members
  • 4 posts

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

#2 tesla1889

  • Members
  • 351 posts
  • LocationSt. Petersburg

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....data=some_value
read via http://www.your-url....some_identifier

then, in script.php, get the input and generate the appropriate response html

#3 Xeno

  • Members
  • 4 posts

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

#4 1lann

  • Members
  • 516 posts
  • LocationSeattle

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.

#5 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

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.

#6 CometWolf

  • Members
  • 1,283 posts

Posted 27 March 2014 - 06:52 PM

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

#7 Xeno

  • Members
  • 4 posts

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

#8 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

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.

 CometWolf, on 27 March 2014 - 06:52 PM, said:

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.

#9 twormtwo

  • Members
  • 14 posts
  • LocationFlorida, USA

Posted 28 March 2014 - 03:16 AM

 Xeno, on 27 March 2014 - 11:16 PM, said:

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...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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users