Jump to content

Odd idea Wanting to know if its Do-able

api computer

2 replies to this topic

#1 RustyDagger

  • Members
  • 5 posts

Posted 18 April 2014 - 04:39 AM

Back Story: (reason for this )
I am playing a DW20 FTB server and I Have a spot loader in my house there are some builds in the chunk that Do not need to be running when one of the players from our group are not online so I need some way to get a list of online players to base some logic on to turn Builds on and off to prevent server lag.


Is it Possibal to use the http Api to some how use this webpage to return me a list of Online players for the server.

If so where would be the best place to start looking iv already looked at the wiki for the http api and it left me a little confused.

#2 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 18 April 2014 - 06:58 AM

You can download the contents of the webpage like this:
local response = http.get("http://www.atrminecraft.enjin.com/home") --#get response
if response then
 local sResponse = response.readAll() --#set sResponse to the webpage's data
 file = fs.open("atrminecraft", "w") --#open a new file "atrminecraft"
 file.write(sResponse) --#save the webpage data to "atrminecraft"
 error("Can't connect to atrminecraft!") --#if computer cannot reach website
But I can't make (much) sense of the HTML formatting. It also seems to be locked in some way, as I cannot open the file in TextEdit (I'm on a mac) The whole file is 1 line, and idk how long that line is... Makes it really hard to figure out what you're looking at.

Edited by KingofGamesYami, 18 April 2014 - 03:50 PM.

#3 RustyDagger

  • Members
  • 5 posts

Posted 18 April 2014 - 11:43 PM

thank you! I will see what I can do from there Im sure i can do something but first things first get me a copy of that file and try and take a look at it. manipulating it could be troubblsome :0

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users