Posted 28 July 2013 - 05:02 PM
Hello!
Im in trouble!
i've made a website which checks if a ComputerCraft server is open / not.
then i've made a CC program as follows:
but i want it to detect what the :
Thanks in Advance :P/>
Im in trouble!
i've made a website which checks if a ComputerCraft server is open / not.
then i've made a CC program as follows:
local chatBox = peripheral.wrap("top")
myUrl = "*hided for security reasons*"
if http then
while true do
req01 = http.get(myUrl)
local read01 = req01.readAll()
local content = read01
req01.close()
print(read01)
for state in string.gmatch(read01, "$status = (.-);" ) do
if string.lower(state) == "offline" then
status = "right"
elseif string.lower(state) == "online" then
status = "left"
end
end
if status == "right" then
rs.setOutput(status, true)
sleep(0.5)
rs.setOutput(status, false)
elseif status == "left" then
chatBox.say("*Server!* is open again! This server will close in 10 seconds! Remember to save your codes!")
sleep(5)
chatBox.say("Server close-down in 5 seconds! Save your stuffs!")
sleep(5)
chatBox.say("Closing server...")
rs.setOutput(status, true)
sleep(0.5)
rs.setOutput(status, false)
else
print("No statement found!")
end
sleep(5)
end
end
but i want it to detect what the :
$status = "online"
variable is… but i dont remember how.
for state in string.gmatch(read01, "$status = (.-);" ) do
how do i detect what the PHP variable is ?Thanks in Advance :P/>