Jump to content




Web Based Remote, Controll your Computers and Turtles from a browser.

turtle computer networking

5 replies to this topic

#1 Left4Cake

  • Members
  • 272 posts
  • LocationEarth

Posted 08 January 2013 - 04:25 PM

Requires that you have access to a PHP web server

This programs allow you to use a web interface to interact with you computer or turtle. This is just a very basic programe where the server sent the computer/turtle a program and the computer/turtle (if the program supports it) will send back status updates of what it is doing.


Download server code here: http://www.lozengia....mote_server.rar
Interface on Default web host: http://www.lozengia..../test/input.php
Note about Default host:(nothing will happen in the log unless at least one person out there is running the program as defult.)

Computer/turtal code
(change dir to the directory on the server you uploaded the server code too. (unless you want my public example controlling you stuff.)

local function sendOutput( text )
local response = http.get(output .. "?output=" .. textutils.urlEncode(text))
print("Connecting to http for output.")
if response then
-- if page is reseved
if response then
print("Sending output.")
local sResponse = response.readAll()
response.close()
end
end
end

dir = "http://www.lozengia.com/tmas/Downloads/Minecraft/test/"
input = dir .. "input.txt"
output = dir .. "getOutput.php"
while true do
print("Connecting to http")
	local response = http.get(input)
	 if response then
	 print("Page found attepting to download.")
-- if page is reseved
while response do
local sResponse = response.readAll()
		response.close()
		cache = shell.resolve( "temp" )
		local file = fs.open( cache, "w" )
		file.write( sResponse )
		file.close()
		response = nil
		print("Running input from http.")
		shell.run( "temp" )
end
   text = "Finished Running Code."
   sendOutput("Finished Running Code.")
else
   print("Page not found.")
end
print("Yileding befor loop.")
os.sleep( 5 )
shell.run( "clear" )
end


To Do
Spoiler

old versions

V 0.2 server

V 0.1
Spoiler


#2 Left4Cake

  • Members
  • 272 posts
  • LocationEarth

Posted 09 January 2013 - 05:29 AM

Updated to have a web based interface. Plan on making it better as time goes on.

#3 Zudo

  • Members
  • 800 posts
  • LocationUK

Posted 09 January 2013 - 07:07 AM

I started developing something like this but stopped after a serious problem with backslashes.

#4 Left4Cake

  • Members
  • 272 posts
  • LocationEarth

Posted 09 January 2013 - 07:18 AM

Well that is

View PostZudoHackz, on 09 January 2013 - 07:07 AM, said:

I started developing something like this but stopped after a serious problem with backslashes.

Now that is very little info but I am assuming your problem is that backslashes are used to escape strings in PHP, just like the percent sign is to lua.

#5 pielover88888

  • Members
  • 66 posts
  • LocationIn a library that's in a village, huddling my advanced computer as zombies bang on the door.

Posted 25 January 2013 - 05:38 AM

Um..
Can you give me EXACT instructions on how to make this work?

#6 Left4Cake

  • Members
  • 272 posts
  • LocationEarth

Posted 25 January 2013 - 07:04 AM

Well you will need a http server with PHP to upload the file in server.rar. You can either pay for one or install one (like xammp) on to your computer and port forward if you want to be able to accese over the web.

Server
1. Extract server.rar
2. Upload/Copy the server file in it own directory on the sever. (take note of where you put it)
3. Now you should be able to open it in your browser. (http://domain-or-ip/...putit/input.php)

Client for Computer or Turtal

1. Copy the program to Computer/Turtal.
2. Change dir to the url of the directory you put the server files in.
3. Run.

Let me know if it need any more detailes, as the exactness of how to excute these step can vary on a few thing. (Like weather you are hosting the server yourself or are paying for one.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users